簡體   English   中英

PHPMailer 突然發送失敗

[英]PHPMailer suddenly fails sending

我只想問問有沒有辦法解決這個問題。 我的 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.```

最近出現了一連串與 Outlook 相關的問題——我懷疑他們已經停止支持一些舊的 TLS 版本,而只支持那些舊協議的舊 PHP 配置將停止工作。 我認為他們正在許多服務器上緩慢地推出這種更改,因此它會是間歇性的,但會越來越頻繁地發生。

解決方案是更新您的 PHP 版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM