title: Email not working on ASP.net
body: <p>I am new ASP.Net and trying fix an mail issue. My website is hosted on godaddy server and its developed in ASP.Net. Trying to send an mail using following script but its throwing error as <strong>"Failure sending mail"</strong></p>
  
  <pre><code>MailMessage mail = new MailMessage("firstmail@mail.com", "sfirstmail@mail.com");
      SmtpClient client = new SmtpClient();
      client.Host = "myhosting.secureserver.net";
  
      // Tried "relay-hosting.secureserver.net" -Errors-Unable to connect
      // Tried "smtpout.secureserver.net" -Errors-Unable to read data from
      // the transport connection: net_io_connectionclosed
  
      client.Port = 3535;  //Tried 80, 3535, 25, 465 (SSL)
      client.UseDefaultCredentials = false;
      client.DeliveryMethod = SmtpDeliveryMethod.Network;
      client.EnableSsl = false;
      client.ServicePoint.MaxIdleTime = 1;
      client.Timeout = 10000;
      client.Credentials = new NetworkCredential("myloginid@mail.com", "mypassword");
      mail.IsBodyHtml = true;
      mail.Subject = "New Job";
  
      mail.IsBodyHtml = true;
      try
      {
  
          client.Send(mail);
          mail.Dispose();
          Response.Redirect("thankyou.html");
      }
      catch (Exception ex)
      {
          Response.Write(ex.Message);
  
      }
  </code></pre>
  
  <p>When Print the exception got the following in ex:</p>
  
  <blockquote>
    <p>System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport
    connection:  net_io_connectionclosed. at
    System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer,
    Int32 offset, Int32 read, Boolean readLine)  at
    System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader
    caller, Boolean oneLine)  at
    System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader
    caller)  at System.Net.Mail.CheckCommand.Send(SmtpConnection conn,
    String&amp; response)  at System.Net.Mail.MailCommand.Send(SmtpConnection
    conn, Byte[] command, MailAddress from, Boolean allowUnicode)   at
    System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
    MailAddressCollection recipients, String deliveryNotify, Boolean
    allowUnicode, SmtpFailedRecipientException&amp; exception)   at
    System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner
    exception stack trace ---   at
    System.Net.Mail.SmtpClient.Send(MailMessage message) at
    _Default.SendEmail(Object sender, EventArgs e)</p>
  </blockquote>