本文介绍了在C#中发送批量邮件的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们每天发送超过130封邮件....
任何人都可以解释发送批量邮件的最佳方法,而不会透露其他收件人邮件ID '...像BCC ..
请解释
Hi,
We are sending more than 130 mails per day....
Can anybody explain the best method to send bulk mailing without disclosing other recipients mail id''s.... like BCC..
Please explain
推荐答案
public void Messager(string MessagingSubjectLine, string MessageContent, string To, string From, string SMTP)
{
string conn = SMTP;//eg: mail.mydomain.com
conn = conn.Split(new char[] { '=', ';' })[1];
MailMessage varHTMLMail=new MailMessage();
if (To.Split(';').Length > 1)
{
string[] amto = To.Split(';');
foreach (string s in amto)
varHTMLMail.To.Add(s);
}
else
varHTMLMail.To.Add(To);//Used "To" here, change if you want bcc....
varHTMLMail.From = new MailAddress(From);
SmtpClient varSMTPClient;
varHTMLMail.Subject = MessagingSubjectLine;
varHTMLMail.Body = MessageContent;
varHTMLMail.Priority = MailPriority.Normal;
varHTMLMail.IsBodyHtml = true;
varSMTPClient = new SmtpClient(conn);
varSMTPClient.UseDefaultCredentials = true;
varSMTPClient.Timeout = 100000 * 6;
varSMTPClient.Send(varHTMLMail);
}
这篇关于在C#中发送批量邮件的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!