title: How to send mail using SmtpClient in .net?
body: <p>I have the following code which is not working:</p>
  
  <pre><code>public static void SendMail(string content, string title, List&lt;string&gt; address)
  {
     SmtpClient client = new SmtpClient(Server,Port);
     client.Port = Port;
     client.Host = Server;
     client.EnableSsl = false;
     client.Timeout = 10000;
     client.DeliveryMethod = SmtpDeliveryMethod.Network;
     client.UseDefaultCredentials = false;
     client.Credentials = new System.Net.NetworkCredential(Username, Password);
  
     foreach(string to in address)
     {
        MailMessage mm = new MailMessage(From, to, title, content);
        mm.BodyEncoding = UTF8Encoding.UTF8;
        mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
  
        client.Send(mm);
     }
     client.Dispose();
  }
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <blockquote>
    <p>Mailbox unavailable. The server response was: You must give your username and password to send mail through this service</p>
  </blockquote>
  
  <p>You can see that I am passing a username and password. Why am I still getting this issue?</p>