imap_open(): Couldn't open stream

扶醉桌前 提交于 2019-12-24 08:39:16

问题


I am trying to access my gmail inbox using imap. I have applied almost all the possible solutions available here and also in google. But i am facing the same issue.

Below is my code :

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

$mailbox = imap_open($hostname, 'my gmail account', 'my gmail password');

if ($mailbox) 
{
    echo 'if';
} 
else
    {
        echo 'else';
    }
    exit;

When i run this code in to my local system it will give me some message like this :

Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert} in D:\xampp\htdocs\php-imap-mailboxes\test-mail.php on line 4
else
Notice: Unknown: [ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure) (errflg=1) in Unknown on line 0

Notice: Unknown: [ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure) (errflg=1) in Unknown on line 0

Notice: Unknown: [ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure) (errflg=1) in Unknown on line 0

Notice: Unknown: Too many login failures (errflg=2) in Unknown on line 0

I am running this script in to my local system. Please help me in to this as i have already spent lot's of time in this issue.

Thanks, Ali


回答1:


Make sure you have OpenSSL installed.

Here is a related discussion on google groups. https://groups.google.com/forum/#!topic/comp.lang.php/JB5hm8cKi_Q



来源:https://stackoverflow.com/questions/31407571/imap-open-couldnt-open-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!