开发者

How can I add multiple email addresses in Outlook field "To" via C#?

开发者 https://www.devze.com 2023-01-04 07:09 出处:网络
Anybody know how can I add multiple email addresses in Outlook field \"To\" via C#? foreach (var to in mailTo)

Anybody know how can I add multiple email addresses in Outlook field "To" via C#?

foreach (var to in mailTo)
            newMail.To += to + "; ";

When I try do it 开发者_如何学Pythonhow I described this above I receive next kind of string: mail1@mail.commail2@mail.commail3@mail.com


The += operator doesn't work how you are trying to use it.

a += b + c;

has no meaning. If you want to do it this way you'll have to add brackets around the right hand side:

newMail.To += (to + "; ");


newMail.To.Add(new MailAddress(to));
0

精彩评论

暂无评论...
验证码 换一张
取 消