【发布时间】:2016-02-09 10:27:06
【问题描述】:
我进行了广泛的研究,但没有找到可以解决我当前问题的有效解决方案。我想使用他们的 SMTP 服务器通过我的 windows live 电子邮件发送电子邮件。我得到了错误:
“邮箱不可用。服务器响应为:5.7.3 请求的操作已中止;用户未通过身份验证”
我尝试使用我的防火墙,尝试在我的帐户中启用 SMTP 设置,以及我在本网站和其他网站上找到的其他几个解决方案,但没有任何效果。在我的 Outlook/Windows 帐户的最近活动中,我没有看到 SMTP 访问,只有我当前的登录,即使它说我正在连接。
我不反对使用另一个 SMTP 服务器 我正在使用 C#/ASP.NET 这是我的代码:
public static void Email(string name, string recipient, string address, string email, string info)
{
MailMessage mailMsg = new MailMessage();
mailMsg.To.Add(new MailAddress(email));
// From
MailAddress mailAddress = new MailAddress("user@live.com");
mailMsg.From = mailAddress;
//Content
mailMsg.Subject = "Secret Santa";
mailMsg.Body = name + ", your target is " + recipient + ". Please spread the holiday cheer with a soft cap of $20! From an automated mail service";
//SmtpClient
SmtpClient smtpConnection = new SmtpClient("smtp.live.com", 587);
smtpConnection.Credentials = new System.Net.NetworkCredential("user@live.com", "password");
smtpConnection.UseDefaultCredentials = true;
smtpConnection.EnableSsl = true;
smtpConnection.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpConnection.Send(mailMsg);
}
【问题讨论】:
标签: c# asp.net email outlook smtp