如何将Email ID的列表添加到message.To.Add()? [英] How to add Email Id 's list to message.To.Add()?
本文介绍了如何将Email ID的列表添加到message.To.Add()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
StringBuilder sb = new BAL.PageContent().EmailList();
MailAddress fromAddress = new MailAddress("info@captorsolutions.com");
message.From = fromAddress;//here you can set address
message.To.Add(sb); //here you can add multiple to
message.Subject = "Feedback";//subject of email
message.CC.Add("cc@site.com");//ccing the same email to other email address
message.Bcc.Add(new MailAddress("bcc@site.com"));//here you can add bcc address
message.IsBodyHtml = false;//To determine email body is html or not
message.Body = @"Plain or HTML Text";
smtpClient.Send(message);
在message.To.Add(sb)时出错.
可以在stringbuillder中添加电子邮件列表吗?
谢谢.
getting an error at message.To.Add(sb).
can we add email list in stringbuillder?
Thanking you.
推荐答案
多个电子邮件地址必须用逗号分隔(,")
如果正确,请致电
Multiple e-mail addresses must be separated with a comma character (",")
If that is right, just call
message.To.Add(sb.ToString());
欢呼
Cheers
正如Mario所说,多个电子邮件ID必须以,"分隔.因此,请确保返回的电子邮件列表具有逗号分隔的电子邮件ID.
谢谢
As Mario said, multiple email id needs to be specified in "," separated. So make sure the return email list has the coma separated email ids.
Thanks
使用
message.To.Add(sb.ToString());
这篇关于如何将Email ID的列表添加到message.To.Add()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文