fetching gmail inbox with imap

Simer Twilio Toronto developer picture Simer Twilio Toronto developer · Dec 24, 2010 · Viewed 12k times · Source

i got a code from here to download gmail inbox: http://davidwalsh.name/gmail-php-imap

use these 2 hostnames 
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
{imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox

but getting this error.

 Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox in /home/medicalh/public_html/testmail.php on line 9
Cannot connect to Gmail: Can't connect to gmail-imap.l.google.com,993: Connection timed out

i have searched on stackoverflow but did't got solution

thanks

Answer

Shakti Singh picture Shakti Singh · Dec 24, 2010

change you host name to this one and try

$hostname= '{imap.gmail.com:993/ssl/novalidate-cert}';

and double check the username and password