I am trying WebMail.Send() to send mail to multiple email ids. The MSDN library page clearly specifies that multiple email ids should be separated by semicolon(;). However when I try to send mails to multiple ids, I get FormatException with Message that says
“An invalid character was found in the mail header: ‘;’. However if I send mail to single receipent, the mail gets delivered properly.
So, how do I send mails to multiple receipents using WebMail.Send()? Perhaps I am missing something very obvious.
Edit:
Here is the code that I am using.
string [] selectedUserIds = GetEmailIds();
string to = string.Join(";", selectedUserIds);
WebMail.Send(to: to, subject: subject, body: message, cc: cc, filesToAttach: attachments, isBodyHtml:true);
I think it is a documentation error. The delimiter works for
,. This is the standard delimiter for email addresses.See for the System.Net.Mail namespace: http://msdn.microsoft.com/en-us/library/14k9fb7t.aspx – see the last comment.