0

I made an online CRM for our company that checks the imap accounts using php imap library.

I open the connections using imap_open

it works perfectly but sometimes I get an error in the line where imap_open is.

I get [CLOSED] IMAP connection broken (server response)

I thought it was because I had some error where I did not closed the imap connection correctly, but after fixing everything I realized it was because the shared hosting from hostgator that I am using have a limit of 30 max imap connections per hour per IP.

the php code is on the same server that the imap server, is the same domain.

How can I solve this?? is strange that the hosting has a webmail (SmarterMail Enterprise 14.4) and the webmail don't get a conection error, I can open and close emails there all the time and don't get any errors.

Also is strange that while they have me blocked I can send emails using swiftmailer, maybe because sending an email doesn't have to do with opening an imap connection?

Alvaro Hernandorena
  • 610
  • 1
  • 5
  • 18
  • Outgoing emails use SMTP. The webmail component does not necessarily use IMAP. – Max May 05 '16 at 13:46
  • So there is no work arround for this? – Alvaro Hernandorena May 05 '16 at 16:35
  • use connection pooling? Use some other technology that doesn't involve rebuilding the IMAP connection every few seconds? – Max May 05 '16 at 19:37
  • I have to rebuildit because this is running on a shared hosting, so I have a max run time for php scripts, I have to close the conection before the timeout. Could you elaborate on conection pooling??? – Alvaro Hernandorena May 06 '16 at 02:01
  • I don't know if you can do it with PHP; basically, saving connections in a cache to be reused. IMAP connections really only work in one of two ways: 1) long lived while the user is connected, fetching information as the user needs or 2) synchronization: log in, pull all the state locally, only connect to resynchronize state. Creating a connection to do one little thing is extremely hard on the server as it creates a new connection, new SSL, new authentication for every operation you do, hence the rate limit. – Max May 06 '16 at 14:28

0 Answers0