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!


  • I tried your sugestion now I am getting…

    #!/usr/bin/php -q Connecting to (pop3-ssl)) as Ooops Can’t open mailbox {}INBOX: invalid remote specification

    This was the error I was getting…

    #!/usr/bin/php -q Connecting to (pop3-ssl)) as Ooops Can’t open mailbox \{}: no such mailbox

    so I guess this is an improvement :)

  • 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?

  • 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?

  • 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??


  • 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 (pop3-ssl))

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

  • Follow-up:

    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?


  • 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.

  • 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?

  • 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 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.

  • Jim:

    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!

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

    Warning: imap_open() [function.imap-open]: Couldn’t open stream {}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 {}INBOX: invalid remote specification
    Try putting in your full email address as a userid and try again.

    Cheers if you can help

  • Hi,
    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 {}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.

  • Hi,
    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.

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

    $mailbox = imap_open(“{}INBOX”, “”, “password”);

  • 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