首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SSL协商在连接到IMAP (Debian Bullseye)时失败

SSL协商在连接到IMAP (Debian Bullseye)时失败
EN

Stack Overflow用户
提问于 2022-05-25 04:53:28
回答 1查看 903关注 0票数 0

突然之间,我的脚本无法连接到IMAP服务器。它在夜间开始失败,所以我想邮件服务器上有什么更新了吗?

我可以通过我的电子邮件客户端雷鸟,但不能通过PHP IMAP

代码语言:javascript
复制
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

代码

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

发布于 2022-05-25 10:59:23

我自己找到了解决办法。如果您只使用端口/tls/ssl更改为/ssl,它就会工作。

"bug“https://bugs.php.net/bug.php?id=76928

代码语言:javascript
复制
{mail.xxx.com:993/imap/ssl/novalidate-cert/user=catch-all@xxx.com}

解决方案https://bugs.php.net/bug.php?id=78156

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72372113

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档