1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| using System.Net.Mail;
public static void EnvoyerAlerte(string ASujet, string AMessage)
{
string adrDest = "webmestre.untel@gmail.com";
string adrSmtp = "smtp.monfournisseur.com";
using (MailMessage email = new MailMessage())
{
MailAddress exp = new MailAddress(adrDest);
email.From = exp;
email.To.Add(new MailAddress(adrDest, "Mon Site"));
email.Subject = ASujet;
email.Body = AMessage;
SmtpClient smtp = new SmtpClient(adrSmtp);
smtp.Timeout = 10000;
smtp.Send(email);
}
} |
Partager