My client wants to be able to send an e-mail from the Page Editing Screen to a number of e-mail addresses. Every page has a custom field called email_addresses that takes comma seperated addresses:
Every page will have a different set of addresses. I need a textarea below this field in which my client can enter the body of the email and a submit button below that to actually send the email.
I've added a form with a textarea and a submit form to the Page Editing Screen page using the add_meta_box()
function:
// Add metabox
function metabox_after_publish() {
add_meta_box( 'send-email', 'Send E-mail', 'send_email_metabox_content', 'page', 'advanced', 'high' );
}
add_action( 'add_meta_boxes', 'metabox_after_publish' );
// callback function to populate metabox
function send_email_metabox_content() { ?>
<form>
<textarea id="email_content" style="width:100%" rows="6"></textarea>
<p><input id="email_send_button" type="submit" class="button button-primary button-large" value="Send" /></p>
</form>
<?php }
How can I make the form function so it sends the content of the textarea to the email addresses in the custom field?