突然之间,我的脚本无法连接到IMAP服务器。它在夜间开始失败,所以我想邮件服务器上有什么更新了吗?
我可以通过我的电子邮件客户端雷鸟,但不能通过PHP IMAP
Could not connect to {mail.xxx.com:143/imap/tls/novalidate-cert/user=catch-all@xxx.com}
TLS/SSL failure for mail.xxx.com: SSL negotiation failed代码
public function connect(string $folder=''){
$this->mailbox = '{'.$this->host.$this->flags.'/user='.$this->user.'}';
$mailbox = $folder ?: $this->mailbox;
if($this->stream){
if(!@imap_reopen($this->stream, $mailbox, 0, self::CONNECT_RETRIES)){
throw new Error($this, "Could not connect to $mailbox");
}
}
else{
if(!$this->stream = @imap_open($mailbox, $this->user, $this->pass, 0, self::CONNECT_RETRIES)){
throw new Error($this, "Could not connect to $mailbox");
}
}
...
return $this->stream;
}更新
IMAP服务器已更新为只接受TLS1.2或更高版本的Debian Bullseye
当前安装在客户端上的PHP版本是PHP 8.1.4,并且运行Debian Bullseye。它应该是兼容的和最新的。
发现了这个"bug“https://bugs.php.net/bug.php?id=76928
发布于 2022-05-25 10:59:23
我自己找到了解决办法。如果您只使用端口/tls将/ssl更改为/ssl,它就会工作。
"bug“https://bugs.php.net/bug.php?id=76928
{mail.xxx.com:993/imap/ssl/novalidate-cert/user=catch-all@xxx.com}https://stackoverflow.com/questions/72372113
复制相似问题