[英]windows service this mail server requires authentication when attempting to send to a non-local e-mail address
[英]Not able to send E-mail through IIS server (Working in local )
我已经工作了几个月,请有人帮我解决这个问题。 谢谢
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);
}
测试此代码:
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.