Posted on

WordPress 2.5 post by email broken

Yesterday when Comcast was down for scheduled maintenance I tried to blog it by sending an email from my phone to Reality Me via a secret email that WordPress checks once an hour. I actually sent two posts via email and neither were ever seen on the blog. I just found both the posts with a "pending review" status. This seems to be a new behavior in WordPress 2.5 and not a feature that I like. There does not appear to be a setting that allows me to change this behavior. Perhaps it is my turn to write a plugin.

I think having the ability to post by email when I cannot otherwise reach the blog is a powerful feature. Having the post hidden from publication by slapping it into a pending review status makes posting by email a bit useless, at least for my purposes.

14 thoughts on “WordPress 2.5 post by email broken

  1. I’m having the same problem any ideas for a fix?

  2. I haven’t looked into it yet. My first thought is that we could easily modify the code that sets the status but it seems like writing a plugin is probably appropriate. I can understand WP’s programming choice but really there should be a setting or preference that lets the user decide whether or not he wants those emails instantly posted.

  3. Yeah I have looked into it now,

    So when wordpress receives an email via post via email it checks the email address against its registered authors if the email address isn’t registered to an author it marks it as pending.

    So either register your phones email as a author of your blog, Or in wp-mail lines 125 – 135

    // Set $post_status based on $author_found and on author’s publish_posts capability
    if ($author_found) {
    $user = new WP_User($post_author);
    if ($user->has_cap(‘publish_posts’))
    $post_status = ‘publish’;
    else
    $post_status = ‘pending’;
    } else {
    // Author not found in DB, set status to pending. Author already set to admin.
    $post_status = ‘pending’;
    }

    Change $post_status = ‘pending’; to ‘publish’ in both instances.

  4. Excellent! Thank you for the info.

  5. Are you using straight 2.5 or the Postie plugin?

  6. The straight 2.5. I should have posted an update. Daniel Teed nailed it. Very nice new feature in 2.5. If someone submits a post by email and they are not an author, WP2.5 accepts the post in a pending state. You can then approve it for publishing. Imagine soliciting content contributions this way! (I’m considering it!). Now, if you create an author that is associated with the email address, then it goes straight to a published state. You simply need to keep the email secret so something like 43523doug109zz7y@somedomain.com would become the way you publish to your blog from sms or email. I haven’t tested MMS yet. That would be cool if wp2.5 now handles email attachments and videos!

  7. I’m having the same problem. My wp-mail.php does not even have the following lines as mentioned above in it:

    // Set $post_status based on $author_found and on author’s publish_posts capability
    if ($author_found) {
    $user = new WP_User($post_author);
    if ($user->has_cap(’publish_posts’))
    $post_status = ‘publish’;
    else
    $post_status = ‘pending’;
    } else {
    // Author not found in DB, set status to pending. Author already set to admin.
    $post_status = ‘pending’;
    }

    Where do they go in the file. Having to preview the posts before they are published defeats the purpose of emailing the posts. I have done a test from my default users email address and it does not work.

  8. Kathy, have you confirmed that yo have an user setup with the email address that your post is coming from and that user has a role of author or higher?

    If you are missing those lines, are you using wp2.5 or an earlier version? If using wp2.5 you make want to go through the advanced upgrade steps to make sure you copied all the new files over.

  9. I just recently upgraded to wp.2.5 using the advanced upgrade steps. The email address that my post came from is the one set up for admin.

  10. It concerns me that wp-mail.php does not have the lines of code it in. Personally, I’d delete wp-mail.php and recopy a new one from the latest.zip.

    Is the admin email a dedicated email for the purpose of posting to your WordPress site? Or do you also check that email address through a client like Outlook?

    Ah! Let’s try a controlled test. Can you create a dedicated email address for posting purposes only? Something like 234xyz@domain.com where 234xyz is something hard to guess of your choice and @domain.com is your domain name. Then in WordPress add a new user with a first name of “Remote” and last name of “Posting” That user will naturally have the email address of 234xyz@domain.com and no one else will have access to it. Only wordpress will check that address. Next, give the user “Remote Posting” a role of Author.

    Test it by sending an email to 234xyz@domain.com and see if it posts or not.

    Good luck and let us know.

  11. The wp-mail.php I have is the one from the latest zip.

    The admin email address does get checked through my Thunderbird email client.

    I’ll try the other to see if it works and get back to you.

  12. Creating the new user with the same email address that is checked by wordpress did the job. The Test email did get posted.

  13. i have tried blogging by email and it is working excellent.
    thanks for the tips

Leave a Reply