1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
using System.Net.Mail;
private void Mail(string Obj, string Message)
{
string envoiDE = "toto@mail.fr";
string envoiA = "quituveux@mail.fr";
string objet = Obj;
string contenuMail = Message;
string serveurSMTP = "smtp.domaine.fr";
string idSMTP = "toto@domaine.fr";
string mdpSMTP = "hahaha";
MailAddress from = new MailAddress(envoiDE);
MailAddress to = new MailAddress(envoiA);
MailMessage email = new MailMessage(from, to);
email.Subject = objet;
email.Body = contenuMail;
SmtpClient smtp = new SmtpClient(serveurSMTP, 587);
smtp.Credentials = new System.Net.NetworkCredential(idSMTP, mdpSMTP);
smtp.Send(email);
} |
Partager