Using imap functions in php

Status
Not open for further replies.

Carloswaldo

New Member
Messages
6
Reaction score
0
Points
0
Using imap functions in a php script, sometimes they work, sometimes the don't and I get this message:

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

Most of the time. Why is that?
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
I believe the server to use is imap.gmail.com.
 

Smith6612

I ate all of the x10Pizza
Community Support
Messages
6,517
Reaction score
48
Points
48
I believe the server to use is imap.gmail.com.

The address he is seeing is the Reverse DNS address of imap.google.com's IP address. I get the same result when I look up imap.gmail.com in my router's DNS cache. He is probably already using the correct address since he stated that IMAP is working on and off. As to why it's doing that, I'm not sure.
 
Last edited:

Carloswaldo

New Member
Messages
6
Reaction score
0
Points
0
That's right, the code I'm using is:

$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$inbox = imap_open($hostname,$username,$password) or die('No se pudo conectar a Gmail: ' . imap_last_error());

Another fact is that when I'm trying to execute it with Cron Jobs it never works, I mean, the script is executed but in my mail i just recieve the same answer (that it couldnt connect to gmail). Just works sometimes when I visit the script's url.
Edit:
Now, it is working sometimes with Cron Jobs, but nos allways.:dunno:
 
Last edited:
Status
Not open for further replies.
Top