Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Is it always going to be a GMail acccount that you're connecting to? There may be a web service API that you can hook into so that you're transferring mail over port 443 instead. –  Chris McKeown Oct 3 '12 at 8:40
    
Hi Chris, yeah I've been looking into their feed (mail.google.com/mail/feed/atom) but it seems the only option is to get unread mail and it only provides a summary of the email body –  iamjonesy Oct 3 '12 at 14:18
4  
If your hosting provider won't open that port, cancel the service and go somewhere else. There are ports that should be blocked for various reasons such as security, but that really isn't one of them. –  Michael Hampton Oct 7 '12 at 13:47
add comment

2 Answers 2

up vote 3 down vote accepted

You will need to upgrade, or ask your host if they can open up that port.

You actually gave the answer yourself - The port is 993, and afaik there is no way around it.

share|improve this answer
add comment

There's no way around the port block. Instead of upgrading to a dedicated server you could just move to a hosting provider that doesn't block the port or you could see if POP3, preferable over SSL, is an option. No less secure and even easier to code.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.