Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fetching gmail inbox with imap

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

like image 550
Simer Twilio Toronto developer Avatar asked Dec 16 '22 18:12

Simer Twilio Toronto developer


2 Answers

change you host name to this one and try

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

and double check the username and password

like image 136
Shakti Singh Avatar answered Jan 05 '23 00:01

Shakti Singh


Open the php.ini file and remove ; before ;extension=php_imap.dll and restart your server.

Your code will work...

like image 37
hiren Avatar answered Jan 04 '23 23:01

hiren