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);
答案 0 :(得分:0)
在某些地区,465港口无法运作。 试试587端口。