1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
SmtpClient SmtpMail = new SmtpClient();
MailMessage email = new MailMessage("Les Écoles nationales du Québec : <" + from + ">", useremail);
email.Priority = MailPriority.High;
SmtpMail.Host = "smtp.live.com";
System.Net.NetworkCredential auth = new System.Net.NetworkCredential(from, password);
SmtpMail.Credentials = auth;
SmtpMail.Port = 587;
SmtpMail.EnableSsl = true;
SmtpMail.DeliveryMethod = SmtpDeliveryMethod.Network;
email.Subject = subject;
email.Body = body;
try
{
SmtpMail.Send(email);
resetpass(passw, useremail);
RegisterStartupScript("popupScript", "<script type=\"text/javascript\">alert('Mot de passe envoyer par courriel.');window.location.href='Accueil.aspx'</script>");
}
catch (Exception e)//System.Web.HttpException
{
Console.WriteLine("{0}", e.Message);
Console.WriteLine("Here is the full error message output");
Console.Write("{0}", e.ToString());
} |
Partager