1
votes

I'm trying to set up our no-reply email notification with our office 365 account. I've requested to admin to uncheck the SMTP auth and created the app password but still, I'm getting an error on sending an email. Email has MFA

SMTP config

Still throwing exception below

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. [HK2PR02CA0208.apcprd02.prod.outlook.com]

MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress(fromAddress);
message.To.Add(new MailAddress(recipient));
message.Subject = subject;
message.IsBodyHtml = true; //to make message body as html  
message.Body = content;
smtp.Port = port;
smtp.Host = host;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(userName, password);
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);
2

2 Answers

0
votes

Based on your description, if you mean you are using SMTP client submission to send emails and get error? If yes, please check the following requirements for SMTP client submission:

Authentication: You must be able to configure a user name and password to send email on the device.

Mailbox: You must have a licensed Office 365 mailbox to send email from.

Transport Layer Security (TLS): Your device must be able to use TLS version 1.0 and above.

Port: Port 587 or port 25 is required and must be unblocked on your network.

0
votes

We've finally able to send an email after trying a lot of scenarios with our ad admin.

  • Disable MFA for the no-reply email account
  • Set the value to check on the SMTP authenticated
  • Reset the password of the no-reply email account(this seems to be the crucial part not sure why there is a need to reset the password but it does work when we finally do this reset password thing!)