HAJJAJ
HAJJAJ

Reputation: 3777

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

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]

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("[email protected]", "*******");

        // Set up the email message
        MailMessage mailMessage = new MailMessage();
        mailMessage.From = new MailAddress("[email protected]");
        mailMessage.To.Add("[email protected]");
        mailMessage.Subject = EmailSubject;
        mailMessage.Body = EmailMsg;
        mailMessage.IsBodyHtml = true;
        smtpClient.Send(mailMessage);

Application password is added as you can see enter image description here

SMTP is enabled for that Mailbox also enter image description here

SMTP Disabled status : not disabled enter image description here any help will be very apricated. thanks

Upvotes: 1

Views: 6584

Answers (3)

danicode
danicode

Reputation: 887

I had also the error

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.139 Authentication unsuccessful, account locked. Contact your administrator.

The problem was with the internet provider. I changed to a hotstop and then stated working again. Hope it helps others.

Upvotes: 0

Jamal
Jamal

Reputation: 422

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 enter image description here

Image #2 enter image description here

enter image description here

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

Upvotes: 1

Eugene Astafiev
Eugene Astafiev

Reputation: 49405

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.

Upvotes: 0

Related Questions