我已经尝试发送消息已有一段时间了。但是Stmp.send失败并给出了错误。
连接尝试失败,因为一段时间后连接方未正确响应,或者建立的连接失败,因为连接的主机未能响应202.71.99.194:25
System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage(
new System.Net.Mail.MailAddress("[email protected]", "Web Registration"),
new System.Net.Mail.MailAddress(user.Email));
m.Subject = "Email confirmation";
m.Body = string.Format("Dear {0}<BR/>Thank you for your registration, please click on the below link to comlete your registration: <a href=\"{1}\" title=\"User Email Confirm\">{1}</a>", user.Username, Url.Action("ConfirmEmail", "Account", new { Token = user.Id, Email = user.Email }, Request.Url.Scheme));
m.IsBodyHtml = true;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.google.com");
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("[email protected]", password);
smtp.Send(m);
我禁用了防病毒软件,但尝试全部失败。请问我哪里出错了?任何帮助,将不胜感激。
选中“端口/防火墙/防病毒”,然后更改安全应用程序设置。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句