How To Set Up Postie With WordPress

For the past week I have been fiddling with Postie, a WordPress plugin that allows posting via e-mail or a mobile phone. The following instructions are specific to WordPress 2.2, Postie 1.1.1, and a DreamHost server. Most information in this walk through can be applied to other configurations but, as a disclaimer, your mileage may vary. I will assume you have a stable WordPress installation already up and running.

First we need to download and install the Postie plugin. To get the files, go to http://www.economysizegeek.com/?page_id=395 and download Postie version 1.1.1 for WordPress 2.1 or higher or get Postie version 1.0.1 for WordPress 2.0. If you’re running an older version of WordPress you will need to look around for an earlier version of Postie.

Unpack the Postie plugin and upload it to your plugins directory at wp-content/plugins/postie. Login to your WordPress Admin interface and click on the Plugins section. Postie should now be a listed plugin; simply click Activate to turn it on. If you go to Options and then the Configure Postie subsection you will see the many configuration options to tweak Postie just the way you want it. There are too many options to explain here, besides most of them need no explanation.

In order for Postie to post the e-mails you send it, you need to authorize your e-mail address. Any e-mail not listed here will be rejected with the option for you to be notified so you can see who is trying to mess with your system.

Defining the directories where Postie will save your images to is pretty important. The default location is within your blog installation root, but this was causing some problems when I ran the configuration test later on. I ended up setting the directories in the Postie folder, or /wp-content/plugins/postie/wp-photos/ and /wp-content/plugins/postie/wp-filez/. These seemed to fix the issues running the tests and when I finally posted images on my blog but I don’t know how important it is to change this.

The banned files list lets you strip out the unnecessary clutter mobile carriers tack on when you send an e-mail or removing signatures. It’s best to send an e-mail to yourself just to see what kind fluff gets added to your message.

Image settings and 3GP settings can be set to taste, leaving us at the most important configuration — the Mailserver Settings. Postie supports Pop3, Pop3 SSL, IMAP, and IMAP SSL. However Dreamhost doesn’t have IMAP support in their out-of-the-box PHP installation. If you really want these features you can always compile your own PHP installation but for our purposes we will just stick with basic Pop3.

You need a mail server that will let you authenticate over a non secure connection. This means Gmail is out because you need Pop3 with SSL in order to authenticate your account. DreamHost users can use their own mail server usually at mail.yourdomain.com with the default port of 110. Your mail ID needs to include the domain name at the end like something@domain.com. This step really hung me up since it was never made clear. If you want a super hard to guess mail ID use GRC’s Ultra High Security Password Generator. Nothing like a bunch of random characters to ease the mind of the super paranoid. Click Update Options to save your changes.

Mailserver Settings

Now we should have everything set-up so we can begin to post from the field. To make sure things are working ok, run the Configuration Test. This will let you know if your mail settings are correct and if Postie can find and write to your image and filez directories. Hopefully everything checked out ok here. If they didn’t go back and double check your settings.

Now we can go back and run Postie manually. Before doing this we need to have a message on the mail server for Postie to grab. Hit the Run Postie button and watch in amazement. You’ll know if Postie pulled your message down otherwise you will most likely get the vague message There does not seem to be any new mail. If you do get that message, check your e-mail account to verify there is an unread message sitting there. If that’s not the problem it is most likely an authentication or mail ID issue.

Check your blog to see what Postie did with your current settings. If it is outputting something different than you expected, go back and tweak the settings, send a new message to your e-mail account and run Postie again. I didn’t like the markup coming from Postie so I went into the /wp-content/plugins/postie/postie-functions.php file and cleaned up a little bit.

We are almost done setting up Postie. All that is left is to set-up a CRON Job in order to run Postie at a specified interval. As it is now we would have to login to WordPress and manually run Postie whenever we wanted to make a post via e-mail. Normally you would have to shell in and type a bunch of archaic commands into a Unix prompt to set this up, but DreamHost makes this easy with their Cron Jobs tool. Login to your DreamHost Panel at https://panel.dreamhost.com and click on Goodies -> Cron Jobs. Click Add New Cron Job and copy and paste the following command, replacing the domain info with your own.

curl http://www.yourdomain.com/your-WP-Directory/wp-content/plugins/postie/get_mail.php

When this CRON Job is run, the server will go to the URL, triggering Postie and publishing your post. Be careful when determining the interval for running the CRON Job because running it too frequently uses CPU cycles and shared hosting companies don’t really like that. Running once an hour should be fine for most needs.

CRON Job

A major drawback of this approach is any special formatting options like DIV containers and special markup will not be included. This is because when you actually login to your WordPress blog it sets a cookie which then allows the special markup to be included. A way to do this would be to use code like this :

curl -c [cookie file] -d log=[username] -d pwd=[password] http://[your blog’s address]/wp-login.php
now you stored the cookie WP gives you upon login. let’s use it:
curl -s -b [cookie file] http://[your blog’s address]/wp-content/plugins/postie/get_mail.php >>/dev/null

Unfortunately Postie meets my needs thus far and I haven’t figured out how to set up the CRON Job in the previous way. You are on your own now.

I hope this guide has given you some clarity about setting up Postie and if I missed anything please let me know in the comments and I shall update this guide.

Further Reading

38 Responses to “ How To Set Up Postie With WordPress ”

  1. [...] – You might remember my how-to post about getting Postie setup on WordPress. The ability to post from my mobile phone has been a lot of fun and makes good use of the 400 [...]

  2. Thank you, i have been trying to change the code and most of the settings, i missed the most obvious way (to change the file path :$ )

    THANKS :-D

    Reply

    Russell Heimlich responded on November 22nd, 2008:

    No prob. Isn’t it great posting to your blog from your mobile phone?

  3. This worked like a charm. Thank you!

    Reply

    Russell Heimlich responded on March 17th, 2009:

    I can speak from experience that if you are just starting out with mobile blogging move the default folder for saving images. By default it stores images in wp-photos within the postie folder. This gets overwritten if you do an automatic update via the WordPress admin interface. So be prepared to lose all of your photos when you update or just do postie updates by hand.

  4. [...] using curl, you can set a cookie, and then use it to access another page – very cool (big thanks to this post from Russell Heimlich for that;  I’m sure more thorough documentation is out there, but his is the post I [...]

  5. I’m trying to set up Postie on my blog and I’m not getting an option screen or function to where I can enter any info about the mail server or email address I plan on using. I already deleted and re-downloaded the plugin. Any ideas? I’m using the newest versions of both wordpress and postie. Thanks.

    Reply

    Russell Heimlich responded on March 31st, 2009:

    Did you look under Settings -> Configure Postie in the WordPress Admin interface? That’s where you put in all of your settings. This post is a tad outdated. If you’re still having trouble I’m sure the folks at the Postie forum can help -> http://forum.robfelty.com/forum/postie

  6. Hi Russell

    Great article. I appreciate the bit about the full username. It’s amazing how many people write incomplete instructions, as if somehow the rest of us are psychic.

    So, I’m having a fundamental problem. I am using the full username, and feel like I’ve changed every variable possible, and yet I still can’t post correctly.
    I cannot post using gmail or yahoo at all. That’s a definite. My http://gator868.hostgator.com/~rodders/wp-mail.php always says “POP3 quit: connection does not exist”.

    That’s ok, cos I can post using a free gmx.com e-mail account, “run postie”, or http://gator868.hostgator.com/~rodders/wp-mail.php shows any mail posted. BUT I need help. It only posts plain text. It won’t post rich text or images.

    Secondly, when I moved my wp-filez and wp-photos folders to the postie directory I cannot “run postie” (although wp-mail still works), and it says the filez & photos directories are unwritable. Anyways, the first issue is the real kicker.

    Any ideas?

    Thanks
    James

    Reply

  7. And yes, I have Prefered Text Type (HTML/plain): set to html

    Reply

  8. This is the comment from my webhost:

    777 permissions on folders and files is a website security risk, so we do not allow you to have them.

    Most hosting companies now use phpSuExec servers, thus 755 will allow you to install, run, and execute scripts just like 777 does. Because of this, most scripts do not mind if you use 755

    Reply

  9. Who’s the fing man with a plan stan, yeah that’s me. Fixed it.
    Ok, I hope this works for Lis or anyone else with this problem.
    I tried the following trial and errors until I got to the root, so maybe don’t waste your time with these.
    I thought maybe the permissions on the wp-filez, wp-photos and uploads was the problem. Firstly, my host won’t allow 777 access. But anyway, 766, or 755 works.
    Secondly, I realised I also had the built in “post by e-mail” activated. Infact, the plain posts which I was able to send were ONLY coming through that. Once I deactivated “post by e-mail”, I got no posts, so Postie wasn’t even working.
    In a nutshell, I removed everything related to postie. Deactivated and deleted all plugins, Crons, whatever.
    Then searched for “postie” in wordpress plugin directory, and loaded Postie 1.3 Alpha. That’s all you need. In this version, all the sections are now in tabs along the top e.g. User, Message, Image.
    Essentially what was screwing me up was I was running off of Cronless Postie Plugin 1.3

    I think my rule of thumb now is, if something don’t work, uninstall and start over.

    Hope it works!

    Reply

    Russell Heimlich responded on June 7th, 2009:

    Sounds like good advice.

  10. run into another problem. Postie only works when I click “run postie”. Otherwise it won’t update my posts. Any ideas anyone?
    Thanks

    Reply

    Russell Heimlich responded on June 15th, 2009:

    You need to set-up a cron job that runs at a specified interval so it checks your postie e-mail account. The 6th paragraph from the bottom goes into some details about this.

  11. Hi Thanks Russell

    That seems clear. I’ve decided to go for Cronless Postie. Works great. Simple setup.
    My regular “post by e-mail” function is also working.
    But I am a bit perplexed by the following error I get when I run: http://gator868.hostgator.com/~rodders/wp-mail.php

    Warning: chdir() [function.chdir]: Inappropriate ioctl for device (errno 25) in /home/rodders/public_html/wp-mail.php on line 3

    Looking in my wp-mail.php file here is the text:

    ” Writing
    *
    * @package WordPress
    */

    /** Make sure that the WordPress bootstrap has run before continuing. */
    require(dirname(__FILE__) . ‘/wp-load.php’);

    /** Get the POP3 class with which to access the mailbox. */
    require_once( ABSPATH . WPINC . ‘/class-pop3.php’ );

    $time_difference = absint(get_option(‘gmt_offset’)) * 3600;

    $phone_delim = ‘::’;

    $pop3 = new POP3();

    if ( ! $pop3->connect(get_option(‘mailserver_url’), get_option(‘mailserver_port’) ) ||
    ! $pop3->user(get_option(‘mailserver_login’)) ||
    ( ! $count = $pop3->pass(get_option(‘mailserver_pass’)) ) ) {
    $pop3->quit();
    wp_die( ( 0 === $count ) ? __(“There doesn’t seem to be any new mail.”) : wp_specialchars($pop3->ERROR) );
    }”

    I’m not very good at figuring out what line 3 is. I need to read up on how to figure out what determines a line.

    Any ideas?

    Thanks

    James

    Reply

  12. That last comment isn’t really so important.

    Ok, so now I can send posts no problem. But whether I send an e-mail or an MMS from my mobile to WordPress through Postie it shows up as a grey box. Maybe I can understand the MMS not being translatable or something, but my phone just accesses my normal mail (GMX) though POP3.
    Note: If I send an e-mail with attached picture from my GMX E-mail account to my WordPress blog through Postie, it shows up as it should i.e. the text & image shown in the post.
    And the e-mail I sent from my phone shows up as an e-mail with attached picture in my mailbox. The very same message has the greybox problem as above.

    I really think it’s a WordPress or Postie issue rather than my mobile carrier.

    Please any help needed

    thanks in advance

    James

    Reply

  13. After discovering the basics of email-publishing I found the plugin Postie. I was very delighted. Many Thanx to the developers Dirk and Robert. And for the good “how to” in this post.

    Reply

  14. Hello! I’ve been trying to post to wordpress via email using wordpress’s build-in function and also using postie. I am using a gmx.com account with port 110 since gmail doesn’t work. However, I keep getting a pop3 connection not found error.

    Does anyone know what’s wrong? Thanks!

    Reply

  15. This was easy like counting 1-2-3. Thanks a lot for sharing this – I am especially thankful to you as I was struggling to configure Postie to suit my requirements, but I was not successful. After following your steps, I could achieve what I wanted! Thanks a ton!!

    Reply

  16. wow, good work on your article!

    Reply

  17. Just one thing: On my site, I had to replace the at sign (@) with a plus sign (+) for the “Mail Userid.”

    Maybe that will help someone.

    – Art

    Reply

  18. Thanks for the instructions, very informative. However, there is one key piece of information, while perhaps obvious to some, I think is vexing others, and there seems to be no clear mention of it here or in the Postie instructions.

    And that is…in order to make Postie work, you have to send the email FROM the unique address you set up in Postie TO the email address of the admin…or any other authorized user.

    I think the natural assumption is to send mails the other way around. Anyway, as obvious as that may be to some, I hope that provides an a-ha moment for someone.

    Reply

  19. mobile phones that have built in cameras are my favorite because they can capture those special moments and events ,-~

    Reply

  20. Hey, superb blog. Is extremely good theme. I just got done with cosmetic courses and would like to initial my own personal website. Thanks for the amazing write-up!

    Reply

  21. I and also my pals came looking through the nice helpful tips from your web page and so all of a sudden got a horrible suspicion I had not thanked the web blog owner for them. All the young men had been absolutely happy to study them and have now in actuality been enjoying those things. I appreciate you for simply being considerably considerate as well as for selecting variety of really good subject areas millions of individuals are really desperate to be aware of. Our own sincere regret for not saying thanks to earlier.

    Reply

  22. After I initially commented I clicked the -Notify me when new comments are added- checkbox and now each time a remark is added I get four emails with the identical comment. Is there any approach you’ll be able to remove me from that service? Thanks!

    Reply

  23. У Саманты был талант превращать плачевную ситуацию в безнадежную

    Reply

  24. Высшее торжество для писателя заключается в том, чтобы заставить мыслить тех, кто способен мыслить.

    Reply

  25. I was just searching for this info for a while. After 6 hours of continuous Googleing, finally I got it in your web site. I wonder what is the lack of Google strategy that do not rank this kind of informative sites in top of the list. Generally the top web sites are full of garbage.

    Reply

  26. It’s actually a great and useful piece of information. I’m satisfied that you shared this helpful information with us. Please keep us up to date like this. Thank you for sharing.

    Reply

  27. Одинокий человек — это, так сказать, неполное существо; когда человек ищет общества себе подобных, он лишь повинуется властному голосу природы, который постоянно кричит ему: горе одинокому!

    Reply

  28. An interesting dialogue is value comment. I feel that you need to write extra on this topic, it may not be a taboo topic however typically individuals are not sufficient to talk on such topics. To the next. Cheers

    Reply

  29. I’m commenting to let you be aware of what a incredible discovery our child found using your web site. She discovered numerous things, with the inclusion of how it is like to possess a marvelous giving nature to make a number of people completely know just exactly several multifaceted issues. You really surpassed our own expectations. Thank you for distributing those important, trustworthy, revealing not to mention unique tips about this topic to Mary.

    Reply

  30. I’ll right away clutch your rss feed as I can’t find your email subscription link or e-newsletter service. Do you have any? Please allow me know so that I may subscribe. Thanks.

    Reply

  31. Любовь к людям начинается с любви к себе.

    Темперамент — это закостенение вашей личности. Надо быть любым.

    Reply

  32. Hmm it seems like your blog ate my first comment (it was super long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to the whole thing. Do you have any tips and hints for novice blog writers? I’d definitely appreciate it.

    Reply

  33. Thanks for this post my brother, wish there were more people like you…

    Reply

Leave a Comment of Your Own