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.

 

 

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);
}
}
}

Be Sociable, Share!

Leave a comment