Password recovery from Gmail

K011gusain89
Posted by K011gusain89 under C# category on | Points: 40 | Views : 1161
try
{
var fromAddress = "meetkuldeepgusain@gmail.com"; // Gmail Address from where you send the mail
var toAddress = YourEmail.Text.ToString(); //Address To wher you send the mail. YourEmail.Text is a textbox.
const string fromPassword = "*********************"; //Password of your gmail address
string subject = "Password Confirmation";
string body = "Your new password is --: " + Session["pws"] + " ";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
smtp.Send(fromAddress, toAddress, subject, body);
}
catch (Exception) { }

Comments or Responses

Login to post response