Reputation: 11
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);
Upvotes: 1
Views: 7004
Reputation: 11
We've finally able to send an email after trying a lot of scenarios with our ad admin.
Upvotes: 0
Reputation: 61
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.
Upvotes: 0