我几个月来一直在努力,请有人帮我解决这个问题。谢谢
try
{
SmtpClient smtpServer = new SmtpClient();
MailMessage mail = new MailMessage();
smtpServer.Credentials = new System.Net.NetworkCredential("iejabdb@otlook.com", "throughput");
smtpServer.Port = 25;
smtpServer.Host = "*****";
smtpServer.EnableSsl = true;
smtpServer.UseDefaultCredentials = true;
mail.From = new MailAddress("*****@outlook.com", "Work Order System");
mail.To.Add("*******@outlook.com");
// mail.To.Add(receiptsArray.ToString());
mail.Subject = "Test";
mail.Body = "Hello";
smtpServer.Send(mail);
}
答案 0 :(得分:0)
测试此代码:
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.live.com");
mail.From = new MailAddress("mawlud.f.m@hotmail.com");
mail.To.Add("mawlud.f.m@gmail.com");
mail.Subject = "Mail Subject";
mail.Body = "Mail Body";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("mawlud.f.m@hotmail.com", "Write Your Password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);