title: How can I Authenticate by username and pass in MailKit?
body: <p>I am using Mailkit to send mails in my asp.net core 3.1 application.
  I can connect and authenticate using my google account. But when I moved to use my business account, I can not authenticate using starttls option with the following code:</p>
  <pre><code>                client.CheckCertificateRevocation = false;
                  client.Connect(  Host,25, SecureSocketOptions.StartTls);
                  client.Authenticate(new NetworkCredential(Username, Password));
  </code></pre>
  <p>The result is &quot;535: 5.7.3 Authentication unsuccessful&quot;.
  However, I can connect using .net smtpclient using this code:</p>
  <pre><code>                var smtpclient= new System.Net.Mail.SmtpClient();
                  ServicePointManager.ServerCertificateValidationCallback =ValidateServerCertificate
                  smtpclient.Host = Host;
                  smtpclient.Port = 25;
                  smtpclient.EnableSsl = true;
                  var cred= new System.Net.NetworkCredential();
                  cred.UserName =Username;
                  cred.Password = Password;
                  smtpclient.Credentials = cred;
                  smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network;
                  smtpclient.Send(message);
  </code></pre>
  <ul>
  <li>If I removed the domain name from my username, I can authenticate but not starttls mode.</li>
  <li>I can connect anonymous using starttls.</li>
  </ul>
  <p>So how can I solve  this issue?
  This is sample of my log:</p>
  <pre><code>Connected to smtp://ip:25/?starttls=always
  S: 220 xxxxxxx Microsoft ESMTP MAIL Service ready at dt
  
  C: EHLO [ip]
  
  S: 250-xxxx Hello [ip]
  
  S: 250-SIZE 104857600
  
  S: 250-PIPELINING
  
  S: 250-DSN
  
  S: 250-ENHANCEDSTATUSCODES
  
  S: 250-STARTTLS
  
  S: 250-X-ANONYMOUSTLS
  
  S: 250-AUTH NTLM LOGIN
  
  S: 250-X-EXPS GSSAPI NTLM
  
  S: 250-8BITMIME
  
  S: 250-BINARYMIME
  
  S: 250-CHUNKING
  
  S: 250 XRDST
  </code></pre>