Setting up WordPress to accept posts via email
I got WordPress to accept posts via email!
This involved a one-time setup:
- Set up an email account with a difficult name (random numbers and letters).
- Change the email posting settings in the dashboard.
- Make a few tweaks in wp-mail.php, which handles posting by email, since the off-the-shelf version of that file was buggy in the way it handles single quotes.
- The first tweak:
//add this line add_filter('phone_content', 'addslashes'); //before this line: $post_content = apply_filters('phone_content', $content); - The second tweak:
// delete this line if (!preg_match('#=?(.+)?Q?(.+)?=#i', $subject)) { // keep this line $subject = wp_iso_descrambler($subject); // add this line $subject = addslashes($subject); // delete this line } - Set up ‘curl http://www.larryperson.com/blog/wp-mail.php’ as a cron job. wp-mail.php causes WordPress to go check for email sent to that special account.
After you do the one-time setup, if you send mail to the special account you set up in step 1, the mail will appear as a post (with the headers stripped off) in your blog the next time the cron job runs. The subject of the mail becomes the title of the post.
Filed under: Uncategorized
Permalink