title: smtp exception "failure sending mail"
body: <p>I am making an SMTP mail application with C#.Net. It is working ok for Gmail settings, but I have to work it for a connection to VSNL. I am getting an exception: <em>"Failure sending mail"</em></p>
  
  <p>My settings seem perfect. What is the problem? Why am I getting the exception?</p>
  
  <pre><code>MailMessage mailMsg = new MailMessage();
  MailAddress mailAddress = new MailAddress("mail@vsnl.net");
  mailMsg.To.Add(textboxsecondry.Text);
  mailMsg.From = mailAddress;
  
  // Subject and Body
  mailMsg.Subject = "Testing mail..";
  mailMsg.Body = "connection testing..";
  
  SmtpClient smtpClient = new SmtpClient("smtp.vsnl.net", 25);
  
  var credentials = new System.Net.NetworkCredential("mail@vsnl.net", "password");
  
  smtpClient.EnableSsl = true;
  smtpClient.UseDefaultCredentials = false;
  smtpClient.Credentials = credentials;
  smtpClient.Send(mailMsg);
  </code></pre>
  
  <p>I am getting an exception following...</p>
  
  <blockquote>
    <p>System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.</p>
    
    <p>at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)<br>
        at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)<br>
        at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)<br>
        at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
        at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)<br>
        at System.Net.Mail.SmtpClient.GetConnection()<br>
        at System.Net.Mail.SmtpClient.Send(MailMessage message)</p>
  </blockquote>