我是新來的。我最近遇到了來自我的 Windows 服務器的電子郵件發送問題。50% 的情況下郵件無法發送用戶。下面顯示錯誤訊息
*******Password not accepted from server: 421 4.7.66 TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2. Visit https://aka.ms/smtp_auth_tls. [SI2P153CA0009.APCP153.PROD.OUTLOOK.COM]*******
This is my Mail Server Configuration code :
<?php
//require_once('class.phpmailer.php');
//date_default_timezone_set('PRC'); //Set China time zone
date_default_timezone_set('Asia/Dhaka');
$mail = new PHPMailer(); //Instantiate
$mail->SetLanguage("en", 'language.php');
$mail->SMTPDebug = 4;
$mail->SetLanguage("en");
$mail->IsSMTP(); // Enable SMTP
$mail->SMTPAuth = true; //Enable SMTP authentications
$mail->SMTPSecure = 'tls';
$mail->Host = "Smtp.office365.com"; //SMTP server Take 163 mailbox as an example
$mail->Port = 587; //Mail sending port
$mail->Username = "UserName"; //your mailbox
$mail->Password = "Password"; //Your password
?>
我已安裝 Visual Studio 2022 以升級 .NET 框架。你能告訴我如何解決問題嗎?
uj5u.com熱心網友回復:
當出現錯誤訊息時,您應該始終做的第一件事是閱讀它:
TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2. Visit https://aka.ms/smtp_auth_tls
這表明您的服務器,或者至少是您在其上運行的 PHP 版本嚴重過時。最重要的是,我可以看到您使用的是非常舊且不受支持的 PHPMailer 版本,因此請升級.
uj5u.com熱心網友回復:
終于解決了。我更新了我的代碼并使用最新的 PHPMailler 版本。現在獲得 100% 的郵件。下面的代碼對我有用。
<?php
require 'includes/PHPMailer.php';
require 'includes/SMTP.php';
require 'includes/Exception.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(); //Instantiate
$mail->isSMTP(); // Enable SMTP
$mail->Host = "Smtp.office365.com"; //SMTP
$mail->SMTPAuth = "true"; //Enable SMTP authentications
$mail->SMTPSecure = "tls";
$mail->Port = "587"; //Mail sending port
$mail->Username = "Username"; //your mailbox
$mail->Password = "Password"; //Your
?>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/421526.html
標籤:
