简体   繁体   English

PHPMailer 突然发送失败

[英]PHPMailer suddenly fails sending

I just wanna ask if there's a workaround for this one.我只想问问有没有办法解决这个问题。 My phpmailer setup was working and was untouched until it fails sending about a week ago.我的 phpmailer 设置工作正常,直到大约一周前发送失败为止。

Here is my phpmailer config这是我的 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
   )
);

This is the debug output:这是调试输出:

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.```

There has been a rash of issues relating to Outlook lately – I suspect that they have stopped supporting some old TLS versions, and old PHP configurations that only have support for those old protocols will stop working.最近出现了一连串与 Outlook 相关的问题——我怀疑他们已经停止支持一些旧的 TLS 版本,而只支持那些旧协议的旧 PHP 配置将停止工作。 I think they are rolling this change out slowly across their many servers, so it will be be intermittent, but will happen increasingly often.我认为他们正在许多服务器上缓慢地推出这种更改,因此它会是间歇性的,但会越来越频繁地发生。

The solution is to update your PHP version.解决方案是更新您的 PHP 版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM