Below is my code:
{
mm.Subject = "test";
mm.Body = "test";
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.zoho.com";
smtp.EnableSsl = true;
smtp.Port = 465;
NetworkCredential NetworkCred = new NetworkCredential("
support@xyz.com", "XXX");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Send(mm);
}
I am getting following error:
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.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at checkEmail.SendEmailButton_Click(Object sender, EventArgs e)