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

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

问题描述

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

这是我的代码:

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

不返回任何错误,除了:

<块引用>

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

无法连接到 Gmail:无法连接到 gmail-imap.l.google.com,995:连接超时

我注意到如果我将单引号更改为 `<块引用>

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

请帮忙!!!

解决方案

你需要993端口,SSL IMAP端口.

端口 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天全站免登陆