title: Send Email in C# using NTLM
body: <p>I need to send email using NTLM, currently, I'm using the following code to send email</p>
  
  <pre><code>SmtpClient objSmtpClient;
          System.Net.NetworkCredential objNetworkCredential;
          objSmtpClient = new SmtpClient("10.xxx.xxx.xxx", 587);
          objSmtpClient.EnableSsl = true;
          objNetworkCredential = new System.Net.NetworkCredential(userName, password);
          try
          {
              string to = txtto.Text;
              MailMessage objMailMessage = new MailMessage();
              objMailMessage.From = new MailAddress("from@email.com", "sendername");
              objMailMessage.To.Add(new MailAddress("to@email.com"));
              objMailMessage.Subject = "subject";
              objMailMessage.Body = "body";
              objMailMessage.IsBodyHtml = true;
              objSmtpClient.EnableSsl = true;
              objSmtpClient.UseDefaultCredentials = true;
              objSmtpClient.Credentials = objNetworkCredential;
              objSmtpClient.Send(objMailMessage);
          }
          catch (Exception ex)
          {
           MessageBox.Show(ex.Message + " INNER EXCEPTION &gt; "+ex.InnerException +" DATA &gt; "+ex.Data);  
          }
  </code></pre>
  
  <p>The Above code works if I try to change the port to 25 and EnableSSL to false, But when I try to send it using 587 and setting EnableSSL to true it doesn't work.</p>
  
  <p>I'm getting the following error, sometimes I get an Invalid Certificate error.</p>
  
  <p>The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated.</p>
  
  <p>I am also getting this error</p>
  
  <p><a href="https://i.stack.imgur.com/qSxa1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qSxa1.png" alt="enter image description here"></a>
  I think the problem is with Authentication, how can I force to use NTLM</p>
  
  <p>I talked with the IT team they installed a tool on my pc to check email, using that tool email was sent successfully.</p>
  
  <p>The following are the setting which he applied in that tool</p>
  
  <p><a href="https://i.stack.imgur.com/p0sc2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p0sc2.png" alt="enter image description here"></a></p>
  
  <p>Can someone please help</p>