我已使用域名创建了一个office 365管理员帐户。我还在图片中的安全信息显示中启用了我的帐户的两步验证:

但是,每当我使用此帐户发送邮件时,都会出现这样的错误。
2021-02-10 05:33:32 Auth method requested: UNKNOWN
2021-02-10 05:33:32 Auth methods available on the server: LOGIN,XOAUTH2
2021-02-10 05:33:32 Auth method selected: LOGIN
2021-02-10 05:33:32 CLIENT -> SERVER: AUTH LOGIN
2021-02-10 05:33:32 SMTP -> get_lines(): $data is ""
2021-02-10 05:33:32 SMTP -> get_lines(): $str is "334 VXNlcm5hbWU6
"
2021-02-10 05:33:32 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2021-02-10 05:33:32 CLIENT -> SERVER: xxx
2021-02-10 05:33:32 SMTP -> get_lines(): $data is ""
2021-02-10 05:33:32 SMTP -> get_lines(): $str is "334 UGFzc3dvcmQ6
"
2021-02-10 05:33:32 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2021-02-10 05:33:32 CLIENT -> SERVER: xxx
2021-02-10 05:33:37 SMTP -> get_lines(): $data is ""
2021-02-10 05:33:37 SMTP -> get_lines(): $str is "535 5.7.3 Authentication unsuccessful [PN0PR01CA0004.INDPRD01.PROD.OUTLOOK.COM]
"
2021-02-10 05:33:37 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [PN0PR01CA0004.INDPRD01.PROD.OUTLOOK.COM]
2021-02-10 05:33:37 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [PN0PR01CA0004.INDPRD01.PROD.OUTLOOK.COM]
2021-02-10 05:33:37 SMTP Error: Could not authenticate.
2021-02-10 05:33:37 CLIENT -> SERVER: QUIT
2021-02-10 05:33:38 SMTP -> get_lines(): $data is ""
2021-02-10 05:33:38 SMTP -> get_lines(): $str is "221 2.0.0 Service closing transmission channel
"
2021-02-10 05:33:38 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2021-02-10 05:33:38 Connection: closed
2021-02-10 05:33:38 SMTP Error: Could not authenticate.
<br />
<b>Fatal error</b>: Uncaught phpmailerException: SMTP Error: Could not authenticate. in C:\xampp\htdocs\dede\PHPMailer\class.phpmailer.php:1714
Stack trace:
#0 C:\xampp\htdocs\dede\PHPMailer\class.phpmailer.php(1557): PHPMailer->smtpConnect(Array)
#1 C:\xampp\htdocs\dede\PHPMailer\class.phpmailer.php(1340): PHPMailer->smtpSend('Date: Wed, 10 F...', 'This is a multi...')
#2 C:\xampp\htdocs\dede\PHPMailer\class.phpmailer.php(1215): PHPMailer->postSend()
#3 C:\xampp\htdocs\dede\register.php(187): PHPMailer->send()
#4 {main}如何使用两步验证发送SMTP邮件?我还创建了两个活动用户,如user1和user2。如果我想用这个用户发送SMTP邮件,我能做些什么呢?
发布于 2021-02-18 13:37:40
为了使用SMTP身份验证,Office 365需要启用以下设置:
Host = "smtp.office365.com"
Port = 587
SMTPAuth = true;
SMTPSecure = "tls";
SMTPAutoTLS = true;此外,SMTP的值必须与Username的值匹配,否则微软的From服务器将拒绝它。
第二:检查是否为该邮箱启用了SMTP AUTH,请参阅https://docs.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission
另外:如果你必须为这个账户使用MFA,那么确保你使用一个应用程序密码:https://docs.microsoft.com/en-us/azure/active-directory/user-help/multi-factor-authentication-end-user-app-passwords
https://stackoverflow.com/questions/66131572
复制相似问题