protected void SendEmail(string strFrom, string strTo, string strCc, string strSubject, string strMessage, string lang) { try { System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage(); strFrom = strFrom.Trim(); strTo = strTo.Trim(); strCc = strCc.Trim(); if (lang == "Japanese") { msg.BodyEncoding = System.Text.Encoding.UTF8; msg.SubjectEncoding = System.Text.Encoding.UTF8; } else { msg.BodyEncoding = System.Text.Encoding.UTF8; msg.SubjectEncoding = System.Text.Encoding.UTF8; } msg.From = new System.Net.Mail.MailAddress(strFrom); msg.To.Add(strTo); if (strCc != "") { string[] cctoS = strCc.Split('^'); for (int i = 0; i < cctoS.Length; i++) { msg.CC.Add(cctoS[i]); } } msg.Subject = strSubject; msg.IsBodyHtml = true; msg.Body = strMessage; msg.Headers.Add("X-Mailer", "Microsoft Outlook Express 6.00.2900.2869"); msg.Headers.Add("X-MimeOLE", "Produced By Microsoft MimeOLE V6.00.2900.2869"); System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(); //For get message,if send email fail. msg.DeliveryNotificationOptions = System.Net.Mail.DeliveryNotificationOptions. .OnFailure; msg.ReplyTo = new System.Net.Mail.MailAddress("myemailaddress"); smtp.Host = "smtp-au.server-mail.com"; smtp.Send(msg); //send email out } catch (Exception err) { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)