Maria’s Guides

Support and additional material for readers of books, articles, and digital media by Maria Langer.


Random Book Cover #1Random Book Cover #2Random Book Cover #3Random Book Cover #4Random Book Cover #5Random Book Cover #6Random Book Cover #7Random Book Cover #8Random Book Cover #9

Fixing Post By E-Mail In WordPress 2.2

Posted on August 26th, 2007 at 1:38 pm ·
Filed in: RSS WordPress Books   

And some other information you might find useful.

I finally upgraded my personal blog to the latest version of WordPress, which is version 2.2.2 (as I write this). In addition to breaking a handful of my plugins — not a big deal, since I was able to replace just about all of them with newer, better versions — it also broke WordPress’s post by e-mail feature, which we discuss on pages 64-66 of our WordPress book.

The Post by E-Mail Feature and How It Broke

If you’re not familiar with this feature, you might want to be. It’s pretty cool. It enables you to send an e-mail message to a special account you set up for WordPress to check. When WordPress finds a message there, it automatically posts the content of the message to your blog, using a predefined category that you choose. The message subject becomes the post title.

In WordPress 2.2, WordPress simply stopped seeing and importing the body of the message. As a result, you’d wind up with properly titled but otherwise empty post.

The Fix

Some research on WordPress.org uncovered a post which explained the problem and offered patch code for the class-pop3.php file. This file, which resides in the wp-includes folder of a WordPress server installation, is responsible for processing posts by e-mail.

I manually replaced the bad code with the new code in my file and tested the results. It worked fine.

Rather than fiddling around with code like I did, you can simply download the revised file here. UnZip it and use it to replace your current class-pop3.php file. (If you’re smart, you’ll save a copy of your current file — perhaps by renaming it right in the folder in which it resides — before replacing it.)

This file definitely works on my WordPress 2.2.2 setup. It might not work with earlier or later versions of WordPress or on your setup if it has been heavily modified, so try it at your own risk.

A Neat Trick

While I was researching the problem, I picked up a neat trick in the WordPress Codex.

If you use post by e-mail, you probably know that your e-mail messages won’t be posted unless WordPress checks for mail. As we wrote in our book (on page 66), there are at least two ways to do this: manually by opening a specific Web browser page or automatically using a plugin.

But there is another way to automate the process and it’s pretty easy for WordPress novices who aren’t afraid to roll up their sleeves and modify a template file. Simply include the following code in your theme’s footer.php file:

<iframe src="http://<em>yourblogdomain</em>/<em>wordpressinstalldir</em>/wp-mail.php" name="mailiframe" width="0" height="0" frameborder="0" scrolling="no" title=""></iframe>

This forces WordPress to check for mail every time someone loads any page on your site.

The drawback to this is that if your site is very busy, your server will be checking pretty often for e-mail messages. But it seems to me that you could include the same code on another template page that’s used less often, perhaps category.php (if present) or archive.php or page.php.

Hopefully, you’ll find this information useful. As usual, comments are welcome. Use the Comments link or form below to share your thoughts with me and other visitors.

 • Read 465 Times
Add to Del.icio.usAdd to Del.icio.us • Technorati ThisTechnorati This • Digg ThisDigg This • Stumble ItStumble it! • Twit ThisTwit This


 

 

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

If you have a Gravatar, it will appear beside your approved comment.
No Gravatar? Get one free!