1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
System.Web.Mail.MailMessage myMail = new System.Web.Mail.MailMessage();
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", _sSmtpServer);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");
// myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", _sRecipientEmail);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", _sSmtpPwd);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");
Console.WriteLine(String.Format("Building CDO Message..."));
myMail.From = _sSenderEmail;
myMail.To = _sRecipientEmail;
myMail.Subject = "Test message.";
myMail.Body = _sMessage;
myMail.Priority = System.Web.Mail.MailPriority.High;
System.Web.Mail.SmtpMail.SmtpServer = sSmtpServer;
System.Web.Mail.SmtpMail.Send(myMail); |
Partager