fetching gmail inbox with imap
Asked Answered
M

4

5

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

Mikamikado answered 24/12, 2010 at 9:15 Comment(0)
M
2

You can download my Gmail class at my website: . I have also included a test file for you to test the class file.

If it does not work, I believe it could be your server's problem. You should contact your system administrator.

Markle answered 28/12, 2010 at 22:42 Comment(2)
i have tested my code on localhost and that works fine but not on server so i think its server problem, what should i say to my server admin? what things need to activate?Mikamikado
I think you can try this: mail.google.com/support/bin/answer.py?hl=en&answer=78775 under the "Can you connect to the SMTP server?".. From my limited knowledge, for some of the servers, you need to ask them to activate telnet for you so that you can connect to gmail. I have read that in one of the forums some time ago. I have not encountered this problem myselfMarkle
A
5

change you host name to this one and try

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

and double check the username and password

Airship answered 24/12, 2010 at 9:24 Comment(2)
Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}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 outMikamikado
no luck, if i post whole code here, can you test that on your server.Mikamikado
B
4

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

Your code will work...

Brister answered 17/2, 2011 at 17:2 Comment(0)
M
2

You can download my Gmail class at my website: . I have also included a test file for you to test the class file.

If it does not work, I believe it could be your server's problem. You should contact your system administrator.

Markle answered 28/12, 2010 at 22:42 Comment(2)
i have tested my code on localhost and that works fine but not on server so i think its server problem, what should i say to my server admin? what things need to activate?Mikamikado
I think you can try this: mail.google.com/support/bin/answer.py?hl=en&answer=78775 under the "Can you connect to the SMTP server?".. From my limited knowledge, for some of the servers, you need to ask them to activate telnet for you so that you can connect to gmail. I have read that in one of the forums some time ago. I have not encountered this problem myselfMarkle
C
1

One of the issues with gmail IMAP SSL authentication is related to Google's account security.Once you get the login error once, sign out of all your google accounts. Then, visit this link: https://accounts.google.com/DisplayUnlockCaptcha

enter image description here Log in with the account you're attempting to access via imap.

Follow the steps and you'll then be able to login in to gmail with php imap.

It's visually shown here: http://jeffreifman.com/filtered-open-source-imap-mail-filtering-software-for-php/configuring-gmail/

source: http://php.net/manual/en/function.imap-open.php

Costrel answered 16/1, 2016 at 14:52 Comment(1)
I was looking for days for a solution to fix this error and here it is. You're the man, thanks a lot!Giovanna

© 2022 - 2024 — McMap. All rights reserved.