SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

huangapple go评论84阅读模式
英文:

The SMTP server requires a secure connection or the client was not authenticated.(535 5.7.3)?

问题

我对Office 365 SMTP配置感到非常厌烦,我已经完成了所有要求,使用我的Office 365帐户发送电子邮件,但始终显示相同的错误消息:

SMTP服务器需要安全连接或客户端未经身份验证。服务器响应为:5.7.57 客户端未经身份验证以发送邮件。错误:535 5.7.3 身份验证失败 [DX0P273CA0007.AREP273.PROD.OUTLOOK.COM 2023-06-01T20:34:23.527Z 08DB62D998FCDD7E]

  • 我已经尝试使用直接密码,但没有成功。
  • 使用应用程序密码并启用了多因素身份验证,但仍然没有成功。

下面的代码用于发送电子邮件,我认为它没有任何问题:

SmtpClient smtpClient = new SmtpClient("smtp.office365.com", 587);
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential("hajjaj@alhajjaji.com", "*******");

// 设置电子邮件消息
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("hajjaj@alhajjaji.com");
mailMessage.To.Add("hajjaj@gmail.com");
mailMessage.Subject = EmailSubject;
mailMessage.Body = EmailMsg;
mailMessage.IsBodyHtml = true;
smtpClient.Send(mailMessage);

正如您可以看到,已添加应用程序密码。

邮件箱也已启用SMTP。

SMTP禁用状态:未禁用。

任何帮助将不胜感激。谢谢!

英文:

I am totally fed-up with Office 365 SMTP configuration, I have done all requirements to send email using my account on Office 365, and always giving me the same error message :

> The SMTP server requires a secure connection or the client was not
> authenticated. The server response was: 5.7.57 Client not
> authenticated to send mail. Error: 535 5.7.3 Authentication
> unsuccessful [DX0P273CA0007.AREP273.PROD.OUTLOOK.COM
> 2023-06-01T20:34:23.527Z 08DB62D998FCDD7E]

  • I have used direct password and did not work
  • Used App password and activating the MFA and did not work.

the below code is used for sending the email which I don't think it has any issue

 SmtpClient smtpClient = new SmtpClient("smtp.office365.com", 587);
        smtpClient.EnableSsl = true;
        smtpClient.UseDefaultCredentials = false;
        smtpClient.Credentials = new NetworkCredential("hajjaj@alhajjaji.com", "*******");

        // Set up the email message
        MailMessage mailMessage = new MailMessage();
        mailMessage.From = new MailAddress("hajjaj@alhajjaji.com");
        mailMessage.To.Add("hajjaj@gmail.com");
        mailMessage.Subject = EmailSubject;
        mailMessage.Body = EmailMsg;
        mailMessage.IsBodyHtml = true;
        smtpClient.Send(mailMessage);

Application password is added as you can see
SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

SMTP is enabled for that Mailbox also
SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

SMTP Disabled status : not disabled
SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)
any help will be very apricated.
thanks

答案1

得分: 1

为了使smtp.office365.com正常工作,您需要执行以下操作:

  1. 以管理员用户身份登录到Microsoft 365管理中心。
  2. 在菜单中点击Azure Active Directory。如果选项不可见,请点击“显示全部”。请参见图像#1。
  3. Azure Active Directory中,点击页面上的属性。请参见图像#2。
  4. 在页面底部,点击管理安全性默认值
  5. 关闭它并回答为什么要关闭,然后点击保存。请参见图像#3。
  6. 测试您的电子邮件代码。

图像#1
SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

图像#2
SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

顺便提一下,请确保您使用的是.NET Framework 4.8或更高版本,并且用户的Office 365多重身份验证选项已禁用。

英文:

For smtp.office365.com to work, you need to do the following:

  1. Login into the Microsoft 365 Admin Center as an admin user.
  2. Click Azure Active Directory in the menu. If the option is not visible, click Show All. See image #1.
  3. In the Azure Active Directory, click Properties on the page. See Image #2
  4. At the bottom of the page, click Manage security defaults.
  5. Turn it off and answer why you are turing it off, then click Save. # See image #3
  6. Test your email code.

Image #1
SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

Image #2
SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

SMTP服务器需要安全连接或客户端未经身份验证。(535 5.7.3)

BTW, make sure you are using .NET Framework 4.8 or later and user's office 365 MFA option is disabled.

答案2

得分: 0

您的Office 365帐户的SMTP身份验证似乎尚未启用。第三方应用程序使用SMTP提交来验证Office 365帐户。要启用SMTP身份验证,您可以参考Exchange Online中启用或禁用经过身份验证的客户端SMTP提交(SMTP AUTH)文章。

英文:

Sounds like the SMTP authentication of your Office 365 account hasn't been enabled. The third-party application uses SMTP submission to authenticate Office 365 account. To enable the SMTP auth, you can refer to the Enable or disable authenticated client SMTP submission (SMTP AUTH) in Exchange Online article.

huangapple
  • 本文由 发表于 2023年6月2日 05:07:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76385710.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定