title: What type of authentication is System.Net.Mail.SmtpClient using when sending emails?
body: <p>Hopefully this question makes sense. I have some C# code that sends an email message given the username, password, and domain. How do I know what type of authentication it's using?</p>
  
  <p>When I looked at the MSDN page for SmtpClient.Credentials Property it said that if you use basic authentication then credentials are sent over as plain text. Is the below code using basic authentication? MSDN page: <a href="https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.credentials(v=vs.110).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.credentials(v=vs.110).aspx</a></p>
  
  <pre><code>SmtpClient smtpClient = new SmtpClient();
  NetworkCredential cred = new NetworkCredential("username", "password"); 
  MailMessage message = new MailMessage(); 
  MailAddress fromEmail = new MailAddress("from@yourdomain.com"); 
  
  smtpClient.Host = "mail.mydomain.com";
  smtpClient.UseDefaultCredentials = false;
  smtpClient.Credentials = cred;
  
  message.From = fromEmail;
  message.Subject = "my subject";
  
  message.IsBodyHtml = true;
  message.Body = "hello world!";
  message.To.Add("toEmail@anything.com"); 
  
  smtpClient.Send(message);
  </code></pre>