我在System.Net.Mail.SmtpException上收到此错误:操作已超时

时间:2016-07-13 20:50:03

标签: asp.net

MailMessage mail = new MailMessage();
string Subject = "User Inquery";
mail.To.Add("majid_Hussain@yahoo.com");
mail.From = new MailAddress("sundas_05@yahoo.com", "Sundas");
mail.Subject = Subject.Trim();
mail.Body += "Dear Administrator,<br><br>.";
mail.Body += "User Emial: " + Email.Text + "<br>";
mail.Body += "User Message: " + txtBody.Text + "<br><br>";
mail.Body += "Thanks & Regards<br>";
mail.Body += txtName.Text;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.mail.yahoo.com";
smtp.Port = 465;
smtp.Credentials = new System.Net.NetworkCredential("sundas_05@yahoo.com", "*****");
smtp.EnableSsl = true;

smtp.Send(mail);

1 个答案:

答案 0 :(得分:0)

在某些地区,465港口无法运作。 试试587端口。