What ports do I need open for IMAP connections

Posted by iamjonesy on Server Fault See other posts from Server Fault or by iamjonesy
Published on 2012-10-03T08:29:56Z Indexed on 2012/10/03 9:39 UTC
Read the original article Hit count: 306

Filed under:
|
|
|

I'm developing a web application that connects to an IMAP mailbox and fetches emails as part of it's functionality.

The application is PHP and I'm connecting like this:

public function connect()
{
    /* connect to gmail */
    $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
    $username = $this->username;
    $password = $this->password;

    /* try to connect */
    $this->inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
}

Developing locally on my mac this was fine, I was able to connect and get emails. However now that I've put the app on my web hosts server I'm getting the following error:

Cannot connect to Gmail: Can't connect to gmail-imap.l.google.com,993: Connection timed out

After checking with my hosting provider they told me outgoing connections on port 993 are blocked. Is there anyway around this? Otherwise I need to upgrade to a dedicated server :S

© Server Fault or respective owner

Related posts about php

Related posts about firewall