连接到Gmail IMAP PHP“无法打开流” [英] Connecting to Gmail IMAP PHP "Couldn't open stream"

查看:101
本文介绍了连接到Gmail IMAP PHP“无法打开流”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多人有类似的问题,但没有人回答他们的问题。我在PHP中启用了IMAP,使用了所有正确的信息。我没有看到我出错的地方。



这是我的代码:

  $ hostname ='{imap.gmail.com:995/imap/ssl/novalidate-cert}'; 
$ username ='emailaddress@gmail.com'; $ password ='password';
$ inbox = imap_open($ hostname,$ username,$ password)或die('无法连接到Gmail:'。imap_last_error());

print_r(imap_errors());

不会返回以外的任何错误:


警告:imap_open()[function.imap-open]:无法在$ b中打开流
{imap.gmail.com:995/imap/ssl/novalidate-cert} $ b /home/a8066360/public_html/test/imap.php on line 6



无法连接到Gmail:无法连接到gmail-imap.l.google。 com,995:
Connection timed out


我注意到如果我将单引号改为`


由于安全原因,shell_exec()已被禁用...

请帮助!!!

解决方案

您需要port 993 ,SSL strong> port。



端口995是SSL POP3 端口。


There are lots of people having similar issues but no one is answering their questions. I have IMAP enabled in PHP, Using all the correct information. I don't see where I'm going wrong.

Here's my code:

$hostname = '{imap.gmail.com:995/imap/ssl/novalidate-cert}'; 
$username = 'emailaddress@gmail.com'; $password = 'password'; 
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());

print_r(imap_errors());

Not returning any errors other than:

Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:995/imap/ssl/novalidate-cert} in /home/a8066360/public_html/test/imap.php on line 6

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

I've noticed that if I change the single quotes to `

shell_exec() has been disabled for security reasons...

Please help!!!

解决方案

You need port 993, the SSL IMAP port.

Port 995 is the SSL POP3 port.

这篇关于连接到Gmail IMAP PHP“无法打开流”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆