/// <summary> /// Envia correo con URL para reestablecer contraseña /// Cambiar valores de email, contraseña, smtp, etc. desde Web.config. /// </summary> public bool SendEmail(string user) { HomeModel home = new HomeModel(); string pass = home.recuperarContrasena(user); //string UIDD_url = "http://*****:*****@gmail.com"; string senderPassword = WebConfigurationManager.AppSettings["password"].ToString(); //"yiesajpdikycokfg" string smtpClient = WebConfigurationManager.AppSettings["smtpClient"].ToString(); //"smtp.gmail.com" int smtpPort = Convert.ToInt32(WebConfigurationManager.AppSettings["emailPort"].ToString()); //587 SmtpClient client = new SmtpClient(smtpClient, smtpPort); /* * string senderEmail = "*****@*****.**"; * string senderPassword = "******"; * SmtpClient client = new SmtpClient("Smtpout.secureserver.net", 80);*/ client.EnableSsl = true; client.Timeout = 10000; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Credentials = new NetworkCredential(senderEmail, senderPassword); string bodyMailMessage = "Ingresa a la siguiente dirección para restablecer tu contraseña: " + UIDD_url + "<br>" + "<br>" + "<b>Si no solicitaste reestablecer tu contraseña, por favor ponte en contacto con los administradores del sistema.</b>"; MailMessage mailMessage = new MailMessage(senderEmail, user + "@dotech.com.mx", "Restablecer contraseña", bodyMailMessage); mailMessage.IsBodyHtml = true; mailMessage.BodyEncoding = UTF8Encoding.UTF8; //new Thread(() => { client.Send(mailMessage); }).Start(); client.Send(mailMessage); return(true); } catch (Exception ex) { return(false); } }