The SMTP server requires a secure connection or the client was not authenticated
When sending emails via SMTP in .NET using Office/Microsoft 365 email account, you may encounter the following exception:
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated
This problem is usually caused by Azure Security Defaults or MFA. You can use Microsoft Graph APIs to send emails securely: Send mail - Microsoft Graph v1.0.
Or if you have to use SMTP protocol, refer to the following article to fix it: Send Emails using Microsoft 365 in ASP.NET Core - Kontext.
Refer to the following article to learn more:
Python: Send Email via Microsoft Graph API
info Last modified by Raymond 4 years ago
copyright
This page is subject to Site terms.
comment Comments
No comments yet.