Password Recovery control In Asp.Net
- Drage and Drop Password Recovery control
- Put this code in code behind file.
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress(e.Message.From.Address, "Name");
mail.Subject = "Reset Your Password";
mail.To.Add(e.Message.To[0].Address);
mail.IsBodyHtml = true;
mail.Body = "Your Password Has been Reset
";
mail.Body += "You can login with your new password and If Required Change this Password
";
mail.Body +="" +e.Message.Body.ToString()+"" + "
Thank You.";
NetworkCredential loginInfo = new NetworkCredential("gmailID", "Password");
SmtpClient smtp = new SmtpClient();
smtp.EnableSsl = true;
smtp.Host = "smtp.gmail.com";
smtp.Credentials = loginInfo;
smtp.Send(mail);
e.Cancel = false;
}
protected void PasswordRecovery1_SendMailError(object sender, SendMailErrorEventArgs e)
{
e.Handled = true;
}
No comments:
Post a Comment