Есть ли обходной путь? ?
Это код, который я пробовал:
Код: Выделить всё
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require("vendor/autoload.php");
function sendmail()
{
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'smtp-mail.outlook.com';
$mail->SMTPAuth = true;
$mail->Username = 'email';
$mail->Password = 'supersecurepassword';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->SMTPDebug = 2;
$mail->setFrom('email', 'name');
$mail->addAddress('email');
$mail->isHTML(true);
$mail->Subject = 'Test Email';
$mail->Body = 'Welcome to Our Service
Enjoy your experience!
';
$mail->send();
echo "Message sent successfully!";
} catch (Exception $e) {
echo "Message could not be sent. Error: {$mail->ErrorInfo}";
}
}
Код: Выделить всё
2024-12-02 21:27:41 SERVER -> CLIENT: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [AM0PR02CA0198.eurprd02.prod.outlook.com 2024-12-02T21:27:41.476Z 08DD12F68033AE4D]
2024-12-02 21:27:41 SMTP ERROR: Password command failed: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [AM0PR02CA0198.eurprd02.prod.outlook.com 2024-12-02T21:27:41.476Z 08DD12F68033AE4D]
SMTP Error: Could not authenticate.
2024-12-02 21:27:41 CLIENT -> SERVER: QUIT
2024-12-02 21:27:41 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
SMTP Error: Could not authenticate.
Message could not be sent. Error: SMTP Error: Could not authenticate.
Подробнее здесь: https://stackoverflow.com/questions/792 ... l-with-php
Мобильная версия