Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public HttpResponseMessage forgotpasswordmail(String email)
- {
- var user = db.Users.SingleOrDefault(x => x.Email == email);
- MailMessage msg = new MailMessage();
- msg.From = new MailAddress("hanzalaah@gmail.com");
- msg.To.Add(email);
- msg.Subject = "Share It: Password Recovery";
- msg.Body = "Hi, "+user.Name+ "<br />As requested, here is your login details<br /><br />Your Username: " + user.Email + "<br /><br />Your Password: " + user.Password + "<br /><br />Thank you for trusting us! Hope to hear from you soon!<br /><br />";
- msg.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient("smtp.gamil.com", 587);
- smtp.UseDefaultCredentials = false;
- //smtp.Host = "smtp.gmail.com";
- //smtp.Port = 587;
- smtp.Credentials = new System.Net.NetworkCredential("hanzalaah@gmail.com", "Password.");
- smtp.EnableSsl = true;
- smtp.Send(msg);
- return Request.CreateResponse(HttpStatusCode.OK, "Your Password Details Sent to your mail.");
- }
Add Comment
Please, Sign In to add comment