如何讓此代碼發送新的生成密碼或用戶的舊密碼?如何製作「重置密碼」?
我想出瞭如何讓代碼發送電子郵件!發件人不是問題,但接收者是。其中EmailAdresNaar
必須替換爲某人放入文本框或其他內容的電子郵件。
public void SendEmail()
{
string emailAdresVan = "invoerenSVP";
string password = "invoerenSVP";
MailMessage msg = new MailMessage();
msg.From = new MailAddress(emailAdresVan);
msg.To.Add(new MailAddress(EmailAdresNaar));
msg.Subject = Onderwerp;
msg.Body = Bericht;
msg.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
NetworkCredential loginInfo = new NetworkCredential(emailAdresVan, password);
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = loginInfo;
smtpClient.Send(msg);
}
}
}
使用'YourTextBoxControlID.Text'來獲取在文本框中輸入的值用戶並使用它。 – Shyju
重置過程不應該發送新密碼或任何密碼。 http://stackoverflow.com/questions/2734367/implement-password-recovery-best-practice http://stackoverflow.com/questions/1102781/best-way-for-a-forgot-password-implementation – adt