這是我的密碼恢復代碼,但我找不到解決此問題的方法。SMTP異常被捕獲
這是錯誤消息:
這裏是我的代碼:
StringBuilder sb = new StringBuilder();
sb.Append("Hi,<br/> Click on below given link to Reset Your Password<br/>");
sb.Append("<a href=http://localhost:2446/ResetPassLink.aspx?username=" + GetUserEmail(txtEmail.Text));
sb.Append("&email=" + txtEmail.Text + "<a>Click here to change your password</a><br/>");
sb.Append("<b>Thanks</b>,<br> Code Solution <br/>");
sb.Append("thanks");
MailMessage message = new System.Net.Mail.MailMessage("[email protected]", txtEmail.Text.Trim(), "Reset Your Password", sb.ToString());
SmtpClient smtp = new SmtpClient();
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "fromPass");
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
message.IsBodyHtml = true;
smtp.Send(message);