Asp.net blogs

Thursday, 4 July 2013

Forgot Password Recovery via email

Forgot Password Recovery via email -:

 MailMessage mes = new MailMessage();
       
        mes.To.Add(username.text+"@gmail.com");
        mes.From = new MailAddress("admin email id");

        mes.Body = "Your Password is: " + Label2.Text;
       
        SmtpClient client = new SmtpClient();
        client.Host = "smtp.gmail.com";
        client.Port = 587;

        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        NetworkCredential credentials = new NetworkCredential("admin email id","admin email password");
        client.Credentials = credentials;
        client.EnableSsl = true;

        client.Send(mes);
        Label1.Text = "EMail Sent Successful:";