1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| MailMessage myMail = new MailMessage();
myMail.Subject = tbSubject.Text.ToString();
for (int i = 0; i < to.Count; i++)
{
myMail.To.Add(to.ElementAt(i));
}
MailAddress exp = new MailAddress("usr@fai.fr");
myMail.From = exp;
myMail.ReplyTo = exp;
myMail.Sender = exp;
TextRange textRange = new TextRange(rtbBody.Document.ContentStart, rtbBody.Document.ContentEnd);
myMail.Body = textRange.Text;
SmtpClient smtp = new SmtpClient("smtp.fai.fr");
smtp.Credentials = new System.Net.NetworkCredential("usr", "pwd");
smtp.Send(myMail); |