Are you looking for a way to check every 15 minutes for new emails within the account you specify and post them? While there’s probably a plugin for this, we have created a quick code snippet that you can use to post to your blog using email in WordPress.
The subject of your email will be the title and text placed within the body of your email for the post content.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
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); } } }
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 19 best WordPress plugins for photographers and how to create a job application form in WordPress.
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 🙂
Yes it is the email in the settings post via email. If you have any questions please feel free to ask.
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. 🙂