title: Office 365 "535 5.7.3 Authentication unsuccessful"
body: <p>I created an WebApi in Asp.Net Core 1.1, which is hosted in Azure. Sending e-mails is a part of this Api. To do this, I used MailKit.SmtpClient with following code:</p>
  
  <pre><code>using (var client = new SmtpClient())
  {
                  client.LocalDomain = "smtp.office365.com";
                  await client.ConnectAsync("smtp.office365.com", 587, SecureSocketOptions.StartTls).ConfigureAwait(false);
                  client.AuthenticationMechanisms.Remove("XOAUTH2");
                  client.Authenticate(Constants.AccountData.Login, Constants.AccountData.Password);
                  await client.SendAsync(mimeMessage).ConfigureAwait(false);
                  await client.DisconnectAsync(true).ConfigureAwait(false);
  }
  </code></pre>
  
  <p>It works very well until last week. Since then, each time I make </p>
  
  <pre><code>client.Authenticate(Constants.AccountData.Login, Constants.AccountData.Password);
  </code></pre>
  
  <p>I become error 535 5.7.3 Authentication unsuccessful
  I checked the O365 Account and I could normally log in to O365 using Microsoft Login Page and the credentials we use in the App. To be sure, we have changed the password for this account, but this did not help. </p>
  
  <p>I decided to migrate the App to .Net Core 2.0 and check with SmtpClient from .NET libraries. I published the migrated App to Azure and cofigured the SmtpClient as in this post -> <a href="https://blogs.msdn.microsoft.com/benjaminperkins/2017/01/11/sending-email-from-an-azure-web-app-using-an-o365-smtp-server/" rel="nofollow noreferrer">https://blogs.msdn.microsoft.com/benjaminperkins/2017/01/11/sending-email-from-an-azure-web-app-using-an-o365-smtp-server/</a></p>
  
  <p>Right now I become Timeout (The operation has timed out.). </p>
  
  <p>When the property EnableSsl = false, then I become some other Error, that the connection is not secured.</p>
  
  <p>I tried also set the property</p>
  
  <pre><code>client.TargetName = "STARTTLS/smtp.office365.com";
  </code></pre>
  
  <p>but it does not help.</p>
  
  <p>Does anyone have an idea what can i do to make it work?</p>
  
  <p>I have the feeling that the problem is somewhere else (maybe in o365), but i do not know where to look... Any suggestion will be very helpful.</p>