title: How to validate smtp credentials before sending mail?
body: <p>I need to validate the username and password set in an <code>SmtpClient</code> instance before sending mail. Using this code:</p>
  
  <pre><code>SmtpClient client = new SmtpClient(host);
  client.Credentials = new NetworkCredential(username,password);
  client.UseDefaultCredentials = false;
  
  // Here I need to verify the credentials(i.e. username and password)
  client.Send(mail);
  </code></pre>
  
  <p>How can I validate whether the user identified by the credentials is allowed to connect and send a mail?</p>