在digitalocean上使用lemp堆栈的ubuntu上的Laravel和office 365电子邮件时,无法在SMTP服务器上进行身份验证

wgx48brx  于 2023-05-28  发布在  Git
关注(0)|答案(1)|浏览(341)

我在DigitalOcean的Ubuntu droplet上安装了一个Laravel应用程序。现在我正在尝试使用office 365邮件帐户发送电子邮件。但我得到以下错误:

Failed to authenticate on SMTP server with username "info@example.com" using the following
  authenticators: "LOGIN", "XOAUTH2". Authenticator "LOGIN" returned "Expected response code 
  "235" but got code "535", with message "535 5.7.139 Authentication unsuccessful, 
  SmtpClientAuthentication is disabled for the Mailbox. Visit 
  https://aka.ms/smtp_auth_disabled for more information. 
  [AS4P192CA0012.EURP192.PROD.OUTLOOK.COM 2023-05-22T18:20:29.187Z 08DB5A  1254806496]".". 
  Authenticator "XOAUTH2" returned "Expected response code "235" but got code "535", with 
  message "535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for 
  the Mailbox. Visit https://aka.ms/smtp_auth_disabled for more information. 
  [AS4P192CA0012.EURP192.PROD.OUTLOOK.COM 2023-05-22T18:20:39.951Z 08DB5A1254806496]".".

我在.env文件中使用以下配置:

MAIL_MAILER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME="info@example.com"
MAIL_PASSWORD=***PASSWORD***
MAIL_ENCRYPTION=STARTTLS
MAIL_FROM_ADDRESS="info@example.com"
MAIL_FROM_NAME="${APP_NAME}"

我读到我可以启用/禁用SMTP身份验证(https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission)。我猜这就是下面屏幕截图中的设置。我试过勾选和不勾选复选框,但没有区别。

所以问题是:我错过了什么让smpt在我的网站上工作?

72qzrwbm

72qzrwbm1#

错误消息给出了访问此页面的建议:https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission。所以我尝试了验证SMTP检查和未检查,没有看到任何变化。
最后我从这里发现:https://mkerala.com/solution-535-5-7-3-authentication-unsuccessful-office-365-smtp-error/需要一段时间才能使设置生效。在我的情况下大约20分钟。

相关问题