I am New here .I am facing recently Email Send issue from my Windows server. 50% cases mail are unable to send User. Below Error message are showing
*******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
?>
I have install Visual studio 2022 for upgrading .NET framework . Can you please Tell me how can I solved issue ?
CodePudding user response:
The first thing you should always do when presented with an error message is to read it:
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
This suggests that your server, or at least the PHP version you are running on it, is badly outdated. On top of that, I can see that you are using a very old and unsupported version of PHPMailer, so upgrade.
CodePudding user response:
Finally solved it .I updated my code and Using Latest PHPMailler version .getting 100% mail right now .Below code works for me ..
<?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
?>
