我只想问一下有没有解决这个问题的办法。我的phpmailer设置工作正常,直到一周前发送失败。
下面是我的phpmailer配置
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->isSMTP(); // Set mailer to use SMTP
$mail->SMTPDebug = 4; // Enable verbose debug output
$mail->Host = "smtp.office365.com"; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
$mail->Username = "email@email.com"; // SMTP username
$mail->Password = "secret"; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, ssl also accepted
$mail->Port = 587; // TCP port to connect to
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
这是调试输出:
2021-10-28 08:38:24 Connection: opened
2021-10-28 08:38:24 SMTP INBOUND: "220 SJ0PR13CA0238.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 28 Oct 2021 08:38:24 +0000"
2021-10-28 08:38:24 SERVER -> CLIENT: 220 SJ0PR13CA0238.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 28 Oct 2021 08:38:24 +0000
2021-10-28 08:38:24 CLIENT -> SERVER: EHLO webapi.tanholdings.com
2021-10-28 08:38:25 SMTP INBOUND: "250-SJ0PR13CA0238.outlook.office365.com Hello [8.3.126.86]"
2021-10-28 08:38:25 SMTP INBOUND: "250-SIZE 157286400"
2021-10-28 08:38:25 SMTP INBOUND: "250-PIPELINING"
2021-10-28 08:38:25 SMTP INBOUND: "250-DSN"
2021-10-28 08:38:25 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2021-10-28 08:38:25 SMTP INBOUND: "250-STARTTLS"
2021-10-28 08:38:25 SMTP INBOUND: "250-8BITMIME"
2021-10-28 08:38:25 SMTP INBOUND: "250-BINARYMIME"
2021-10-28 08:38:25 SMTP INBOUND: "250-CHUNKING"
2021-10-28 08:38:25 SMTP INBOUND: "250 SMTPUTF8"
2021-10-28 08:38:25 SERVER -> CLIENT: 250-SJ0PR13CA0238.outlook.office365.com Hello [8.3.126.86]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2021-10-28 08:38:25 CLIENT -> SERVER: STARTTLS
2021-10-28 08:38:25 SMTP INBOUND: "220 2.0.0 SMTP server ready"
2021-10-28 08:38:25 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
SMTP Error: Could not connect to SMTP host.
2021-10-28 08:38:25 SMTP NOTICE: EOF caught while checking if connected
2021-10-28 08:38:25 Connection: closed
SMTP Error: Could not connect to SMTP host.```
发布于 2021-10-28 09:46:56
最近出现了一系列与Outlook相关的问题-我怀疑他们已经不再支持一些旧的TLS版本,而只支持这些旧协议的旧PHP配置将停止工作。我认为他们正在缓慢地在他们的许多服务器上推出这种变化,所以这将是间歇性的,但会越来越频繁地发生。
解决方案是更新您的PHP版本。
https://stackoverflow.com/questions/69751187
复制相似问题