We observe that quite recently our Email were failing to authenticate. Upon finding the reason for such action, we found out that a Policy at Office 365 Admin is causing this issue.
Further, we also found out that it's being blocked by a policy that says our App uses a Legacy Authentication scheme. Later it was understood that Microsoft will stop allowing Basic Authentication (Passing a Username and Password as for credentials) in the future and any connection which uses IMAPI, POP and SMTP protocols for connection. Further communication on Office 365 platform should be on minimum TLS 1.1 or 1.2
I am using a Web Job in Azure to execute Emails and for such System.Net.Mail.SmtpClient
for Emailing. This Web Job executes bulk emails. I have checked my App Service, under SSL/TLS properties and have set HTTPS only and TLS 1.2. However, I am using Basic Authentication as the authenticating method. Below is the way I did the coding:
System.Net.Mail.SmtpClient objSmtpClient = null;
//uses the TLS port 587 with authentication
ServicePointManager.ServerCertificateValidationCallback = delegate (object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
objSmtpClient = new System.Net.Mail.SmtpClient("email.host.com", 587);
objSmtpClient.UseDefaultCredentials = false;
objSmtpClient.Credentials = new NetworkCredential(userName, passWord);
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtpClient.EnableSsl = true;
According to these facts, I want to know what are the other ways I can authenticate to Office 365 Email service on a .NET Framework and send Emails? If,
- SMTP protocol is not supported
- Basic Authentication is not supported
References: Can I send SMTP email through Office365 shared mailbox?