电子邮件发送:使用许多邮件发送给许多客户并回复邮件 [英] Email sending: using many mail sending to many customer and reply to a mail
本文介绍了电子邮件发送:使用许多邮件发送给许多客户并回复邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用许多发送给许多客户的电子邮件(被限制)。我希望收到Outlook中指定的邮件的反馈电子邮件,我有办法吗?请!非常感谢! (代码来自c#,asp.net)
SHOUTING已删除 - OriginalGriff [/ edit]
How to using many email(which is configed) sending many customer. And i would like to receive feedback emails to mail specified in outlook, have i to do ? please! thank so much! (code by c#, asp.net)
[edit]SHOUTING removed - OriginalGriff[/edit]
推荐答案
请在下面查看C#中的电子邮件代码链接。
http://stackoverflow.com/questions/18326738/how-to-send-email-in-asp-net-c-sharp [<一个href =http://stackoverflow.com/questions/18326738/how-to-send-email-in-asp-net-c-sharptarget =_ blanktitle =新窗口> ^ ]
http://stackoverflow.com/questions/7498968/how-to-send-email-to-multiple-address-using-system-net-mail [ ^ ]
Please check below links for email code in C#
http://stackoverflow.com/questions/18326738/how-to-send-email-in-asp-net-c-sharp[^]
http://stackoverflow.com/questions/7498968/how-to-send-email-to-multiple-address-using-system-net-mail[^]
试试这个。
如果主题和博dy对所有客户都是一样的,然后看到这个。
Hi,
Try this.
If subject and body is same for all customer then see this.
string from = your registered mail;
string to = String.Empty;
string smpt = your smtp server;
string smptport = your smtp port;
DataTable dt = //get customer list in datatable from database
string SmtpUser = your smtp user(can be same as from);
string SmtpPassword = your smtp user(email) password
int totalcountofcustomer = dt.Rows.Count;
for(int i=0;i<totalcountofcustomer;i++)>
{
to += dt.Rows[i]["CustomerEmail"] + ",";
}
to = to.Substring(0, to.Length - 1); // Remove last extra ','
string subject = your mail subject;
string body = mail body;
MailMessage message = new MailMessage(from, to, subject, body);
message.IsBodyHtml = true; // make it false if you have plain text in body.
SmtpClient smtpClient = new SmtpClient(smpt);
smtpClient.Port = Convert.ToInt32(smptport);
smtpClient.Credentials = new System.Net.NetworkCredential(SmtpUser, SmtpPassword);
smtpClient.EnableSsl = true;
message.ReplyToList.Add(from); // customer can reply to 'from' email address
smtpClient.Send(message);
如果主题和正文在逻辑之间有所不同,请参阅以下内容。
If subject and body is different on some in between logic, then see following.
DataTable dt = //get customer list in datatable from database
int totalcountofcustomer = dt.Rows.Count;
string from = your registered mail;
string smpt = your smtp server;
string smptport = your smtp port;
string SmtpUser = your smtp user(can be same as from);
string SmtpPassword = your smtp user(email) password
for(int i=0;i<totalcountofcustomer;i++)>
{
string to = String.Empty;
to = dt.Rows[i]["CustomerEmail"];
string subject = your mail subject;
string body = mail body;
MailMessage message = new MailMessage(from, to, subject, body);
message.IsBodyHtml = true; // make it false if you have plain text in body.
SmtpClient smtpClient = new SmtpClient(smpt);
smtpClient.Port = Convert.ToInt32(smptport);
smtpClient.Credentials = new System.Net.NetworkCredential(SmtpUser, SmtpPassword);
smtpClient.EnableSsl = true;
message.ReplyToList.Add(from); // customer can reply to 'from' email address
smtpClient.Send(message);
}
希望它可以帮到你。
谢谢。
Hope it helps you.
Thanks.
这篇关于电子邮件发送:使用许多邮件发送给许多客户并回复邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文