X

Post to your blog using email

Place this snippet in the functions.php of your wordpress theme. This snippet will check every 15 minutes for new emails within the account you specify and post them. The Subject of your email will be the title and text placed within the body of your email for the post content.



Code Snippet:


add_action('shutdown', 'retrieve_post_via_mail');
function retrieve_post_via_mail() {
flush();
if(get_transient('retrieve_post_via_mail')) {
return;
} else {
$mail = wp_remote_get(get_bloginfo('wpurl').'/wp-mail.php');
if(!is_wp_error($mail)) {
set_transient('retrieve_post_via_mail', 1, 60 * 15);
} else {
set_transient('retrieve_post_via_mail', 1, 60 * 5);
}
}
}

Comments  Leave a Reply

  1. oh. so stupid of me. it would be email address in ‘Post via e-mail’ in writing section isn’t sir? so sorry to bother you. have a nice day 🙂

    1. Yes it is the email in the settings post via email. If you have any questions please feel free to ask.

  2. excuse me sir. is it email from contact info (profile) or in general setting that this snippet would check? sorry about my english and this probably silly question. 🙂

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!