Crazy Fingers

I am no longer maintaining Crazy Fingers here. Please visit the new home of Crazy Fingers.

December 23, 2005

Setting up WordPress to accept posts via email

I got WordPress to accept posts via email!

This involved a one-time setup:

  1. Set up an email account with a difficult name (random numbers and letters).
  2. Change the email posting settings in the dashboard.
  3. 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
             }
      
  4. 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.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress