突然的PHP错误“警告:imap_open()[function.imap-open]:无法打开流" [英] Sudden PHP Error "Warning: imap_open() [function.imap-open]: Couldn't open stream"
问题描述
好的,此代码运行良好",然后我开始尝试使用它,以使其他人连接到他们的电子邮件,并且由于各种错别字和这样的.
Okay, this code 'was' working perfectly and then I started playing around with it in order to let others connect to their e-mails and as you do ran into a few open stream errors along the way due to various typos and such.
这样做以来,突然之间我根本无法连接到我的电子邮件吗?不久之后,我使用了完全相同的连接代码,然后浏览了我的收件箱.
Since doing this, all of a sudden I can't connect to my e-mail at all? A short while back I was using the exact same connection code and then browsing my inbox.
我总是收到警告:imap_open()[function.imap-open]:无法打开流"错误.
I always get the "Warning: imap_open() [function.imap-open]: Couldn't open stream" error.
这很奇怪,因为我使用的代码与以前完全相同,但是由于遇到错误,我现在无法连接任何东西.反应还需要很多时间.
This is strange as I'm using the exact same code as before, but since bumping into errors I can't connect whatsoever now. It also takes ages to respond.
这是代码:
$mailbox = imap_open('{mail.artisancodesmith.com:143/notls}INBOX', 'admin@artisancodesmith.com', 'PASSWORD');
if ($mailbox) {
$response = "MAIL MENU:<br>
inbox: View your inbox.<br>
compose: Compose an e-mail.<br>
setup: Set your e-mail account's settings.";
$next = "iorcmail";
}
注意:PHP页面正在连接到同一服务器上的电子邮件.
NOTE: The PHP page is connecting to the e-mail on the same server.
更新: 如果我将"mail.artisancodesmith.com"替换为"localhost",它将再次起作用! 我最好使用我的实际IMAP主机-我想我会在将来的某个时间再次查看它是否可以正常工作. 感谢所有提供帮助的人. :)
UPDATE: If I replace "mail.artisancodesmith.com" with "localhost" it works again! I would preferably like to use my actual IMAP host - I'll see if it works again some time in the future I guess. Thanks to all who helped. :)
推荐答案
请使用以下代码成功连接
Please use the below code to connect successfully,
$hostname = "{imap.gmail.com:993/imap/ssl/novalidate-cert}";
$mailbox = imap_open($hostname, 'admin@artisancodesmith.com', 'PASSWORD');
if ($mailbox)
{
// do work....
}
这篇关于突然的PHP错误“警告:imap_open()[function.imap-open]:无法打开流"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!