0

I have written some code to fetch emails from a Gmail mailbox using Zend_Storage_Mail_Imap library. Till now, it was running fine on the development server (where imap_open was disabled). After I moved it to production(imap_open is enabled), the script has stoppped to work. Do I need to disable imap_open for it to work ?

UPDATE: Apparently, the issue is that of fsockopen(). The actual error message is:

Zend_Mail_Protocol_Exception with message 'cannot connect to host; error = Connection Timed Out (errno = 110)'

The relevant values in PHP.ini are:

allow_url_fopen = on

default_socket_timeout = 600 (on production) and 60 (on development)

I did find out, that inside the /library/Zend/Mail/Protocol/Imap.php, the timeout is mentioned as "const TIMEOUT_CONNECTION = 30".

gentrobot
  • 673
  • 6
  • 25
  • 1
    Make sure that outgoing IMAP connections from the production environment to the target IMAP server are not being blocked at a firewall. That's probably what's happening here. – Charles Dec 28 '12 at 01:05
  • @CharlesThanks for the reply ! I think that IS the problem. I tried to run a simple script with nothing in it, but simply the fsockopen() to connect to imap.gmail.com, and it still gave me connection timed out. I have raised a ticket with the hosting provider to look into the firewall issue (if it is blocking it, though I don't see any other reason). – gentrobot Dec 28 '12 at 04:39
  • @Charles: The problem was that of the firewall. Once the provider allowed access, it worked like a charm. Thanks again for the help. – gentrobot Jan 05 '13 at 04:24

0 Answers0