我的MVC Web应用程序时,新用户获取与下面的代码创建发送电子邮件:asp.net的MVC发送电子邮件错误:无法发送电子邮件
private static void SendMail(User user)
{
string ActivationLink = "http://localhost/Account/Activate/" +
user.UserName + "/" + user.NewEmailKey;
var message = new MailMessage("[email protected]", user.Email)
{
Subject = "Activate your account",
Body = ActivationLink
};
var client = new SmtpClient("localhost");
client.UseDefaultCredentials = false;
client.Send(message);
}
这有什么错我的代码,请告诉我。
ERROR : Failure sending mail. {"Unable to connect to the remote server"}
SMTP配置:
检查您的邮件服务器。 – SLaks 2012-01-06 14:18:01
你会得到什么错误?你的stmp服务器如何配置? – 2012-01-06 14:18:09
垃圾邮件收件箱中的任何东西? – 2012-01-06 14:18:29