Why the email could not be sent?
-
public static void SendMail(string receiver,string subject,string content) { MailAddress from = new MailAddress("aa@aa.cn", "aa", System.Text.Encoding.UTF8); MailAddress to = new MailAddress(receiver); MailMessage mm = new MailMessage(from, to); mm.Subject = subject; mm.SubjectEncoding = System.Text.Encoding.UTF8; mm.Body = content; mm.BodyEncoding = System.Text.Encoding.UTF8; SmtpClient client = new SmtpClient("smtp.xxx.xx"); client.Credentials = new NetworkCredential("aa", "xxxx"); client.Send(mm); }
-
public static void SendMail(string receiver,string subject,string content) { MailAddress from = new MailAddress("aa@aa.cn", "aa", System.Text.Encoding.UTF8); MailAddress to = new MailAddress(receiver); MailMessage mm = new MailMessage(from, to); mm.Subject = subject; mm.SubjectEncoding = System.Text.Encoding.UTF8; mm.Body = content; mm.BodyEncoding = System.Text.Encoding.UTF8; SmtpClient client = new SmtpClient("smtp.xxx.xx"); client.Credentials = new NetworkCredential("aa", "xxxx"); client.Send(mm); }
-
public static void SendMail(string receiver,string subject,string content) { MailAddress from = new MailAddress("aa@aa.cn", "aa", System.Text.Encoding.UTF8); MailAddress to = new MailAddress(receiver); MailMessage mm = new MailMessage(from, to); mm.Subject = subject; mm.SubjectEncoding = System.Text.Encoding.UTF8; mm.Body = content; mm.BodyEncoding = System.Text.Encoding.UTF8; SmtpClient client = new SmtpClient("smtp.xxx.xx"); client.Credentials = new NetworkCredential("aa", "xxxx"); client.Send(mm); }
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.Sockets.SocketException: The software in your host gave up a established connection.
-
Don't just post code without an explanation of the problem. What do you mean when you say that the email could not be sent? Do you get an error message? Do you get a delivery status notification? --- b { font-weight: normal; }
-
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.Sockets.SocketException: The software in your host gave up a established connection.