Writer. Warning: opinions. My lawyer advised a disclaimer, but didn't include any jokes to go with. Damned if I can think of any either.


Pardon me while I get nerdy for a minute. Those of you who have known me for a while will remember that I did work in technology before I became a man of leisure.

At any rate, to get the wordpress plugin postie to work with gmail, one must change line 72, which looks like this:
$this->_connection = imap_open("\{$server:$port$option}",$login,$password);

To these two lines:

$server_string = "{".$server.":".$port.$option."}INBOX";
$this->_connection = imap_open($server_string,$login,$password);

Otherwise, gmail responds with a “No such mailbox” error. Yay!

Now I can post to my blog from anywhere using my cell phone. How badass is that?

I can’t fucking figure this out, but sometimes the posts from my phone link to popups, and sometimes not. It seems to be completely arbitrary.

Anyway, you can see how there’s a column to the right of the main page that is the latest images from my phone. It’s neato!

21 thoughts on “postie”

  1. SiliconFalcon

    I tried your sugestion now I am getting…

    #!/usr/bin/php -q Connecting to pop.gmail.com:995 (pop3-ssl)) as blahblah@gmail.com Ooops Can’t open mailbox {pop.gmail.com:995/service=pop3/ssl/notls/novalidate-cert}INBOX: invalid remote specification

    This was the error I was getting…

    #!/usr/bin/php -q Connecting to pop.gmail.com:995 (pop3-ssl)) as blahblah@gmail.com Ooops Can’t open mailbox \{pop.gmail.com:995/service=pop3/ssl/notls/novalidate-cert}: no such mailbox

    so I guess this is an improvement :)

  2. olepetter

    Have you done anythign else to get it to work with gmail ?

    i cant get it to work

  3. Maarten

    Wow Jim! Great help! Thanks a bunch! I finally got my WordPress-writing-by-Gmail thingy to work! Is your music as good as your programming?

  4. Ben

    Please note, I did not need this fix when I was using PHP4, but when I upgraded to PHP5 this fixed my no such mailbox problem.

    Can others validate that this is only needed in PHP5?

  5. Josh Wex

    I’m trying to get Postie to properly display HTML emails that contain pictures within the email message. Right now, no pictures are displayed. Would you have any idea how to fix this??


  6. Pardis

    1. I use Gmail and I’m hosted on Go Daddy. I know I can’t set up a cronjob with Go Daddy, but that’s a separate issue.
    2. In Configure Postie I could only select POP3 and not POP3-SSL, so I opened config_form.php and forced the coniditional in line 343 to return true.
    3. I replaced line 72 in postieIMAP with the two lines above.
    4. When I clicked on Run Postie in Configure Postie, I got the following:


    Connecting to pop.gmail.com:995 (pop3-ssl))

    Fatal error: Call to undefined function: imap_open() in xxxx/wordpress/wp-content/plugins/postie/postieIMAP.php on line 73

  7. Pardis


    Obviously, this means that HasIMAPSupport(false) is returning false…and that’s why I couldn’t select POP3-SSL in the first place. So why is HasIMAPSupport(false) returning false?


  8. Pardis

    OK…I’m dumb. When I click on Test Config, I get this:

    Missing imap_open Sorry – you do not have IMAP php module installed – it is required for this mail setting.

  9. Pardis

    OK, so now I’m in over my head. Go Daddy won’t allow me to use the IMAP module.

    BUT, Gmail uses POP3, not IMAP. So what’s the problem? Isn’t there a POP3 SSL module or something?

  10. Pardis

    So in case the Gmail thing never works out, I set up a Yahoo account, setup POP access, confirmed POP access via Outlook Express, and then changed the settings in Configure Postie, but now I get this:

    Warning: fsockopen(): unable to connect to pop.mail.yahoo.ca:110 in xxxxx/wordpress/wp-includes/class-pop3.php on line 87
    Unable to connect. The server said – POP3 connect: Error [110] [Connection timed out]
    Try putting in your full email address as a userid and try again.

    I tried my full e-mail address and that doesn’t work, either.

  11. emag


    A *big* thank you for this. I was getting close to giving up in disgust, getting postie to work with courier-imap(-ssl) on my mail server. I was getting the same error, and yet could login manually, so I knew that the daemon was working. Your code fixes allow me to login just fine, at least with imap (I haven’t tried imaps yet).

    Again, thanks!

  12. Ed

    This didn’t seem to work for me:(
    Still get this error

    Warning: imap_open() [function.imap-open]: Couldn’t open stream {pop.gmail.com:995/service=pop3/ssl/notls/novalidate-cert}INBOX in /homepages/9/d188817997/htdocs/phooblog/wp-content/plugins/postie/postieIMAP.php on line 72
    Unable to connect. The server said – Can’t open mailbox {pop.gmail.com:995/service=pop3/ssl/notls/novalidate-cert}INBOX: invalid remote specification
    Try putting in your full email address as a userid and try again.

    Cheers if you can help

  13. Jonathan Lumb

    Another slight fix for those people trying to get Postie to work with Google Apps for Domains or Gmail is available on my website. Just a little code change – a syntax problem.


    Hope this helps.

  14. ZappoMan

    If you are having problems with getting postie to work with gmail, and you are using a Win32 server machine, your problem may be related to these PHP bugs…


    Apparently php_imap.dll doesn’t work with php_openssl.dll on Win32.

    The bug appears to have been fixed in PHP builds after Feb. 19, 2007.

  15. Jan

    I got a similar problem. I am neither using postie nor wordpress but it would be really helpful if someone could post the working line of code for imap_open.

    Right now I get the following error:
    Failed with error: Can’t open mailbox {pop.gmail.com:995/service=pop3/ssl/notls/novalidate-cert}INBOX: invalid remote specification

    So I think I got the syntax right, but I am not quite sure, which options I have to turn on or off.
    ssl = on!
    notls? tls?
    novalidate-cert? validate-cert?
    … and so on.

    Could someone please post the working imap_open syntax. Thank you!


    PS: I am using PHP5.0.4 on a Linux Redhat System.

  16. Karlja

    could you post the working imap_open statement that’s actually send to Gmail? (of course without the passwort and the user)

    Like this:

    Thank You.

  17. langdon

    For Karlja and/or anyone else who is wanting to use imap_open() with GMail, but not using WordPress:

    $mailbox = imap_open(“{pop.gmail.com:995/pop3/ssl/notls}INBOX”, “your@email.com”, “password”);

  18. faloco

    Hi Jim, only one question. POstie works great, I post with gmail but can’t put links in the post. Do you know how can I write links? Is there some tag to do it?
    Thank you very much