Take the 2-minute tour ×

I'm creating a new mail definition using the CreateMailMessage function of a MailDefinition. One of the required parameters is recipients. The documentation for this function states that recipients is to be a comma-separated list of recipients, however when I try to send a message to multiple users I am getting the following error:

An invalid character was found in the mail header: ','...

So it seems like this function is not working as intended. Normally I would add all the recipients to the mail message itself, but unfortunately the recipients parameter is required and cannot be left blank. Any ideas?

share|improve this question
see stackoverflow.com/questions/5914481/… –  ken2k Jan 23 '12 at 9:17
@ken2k Yes I saw that question while searching Google for a solution, and I even attempted to implement my solution using a MailAddressCollection. However I cannot find any way to use a MailAddressCollection with a MailDefinition. –  Bizorke Jan 23 '12 at 16:13
add comment

1 Answer

up vote 0 down vote accepted

I got it working but unfortunately its more of a hack than anything.

I take one email address from the "to" field and set it as the recipient in CreateMailMessage, which returns a MailMessage instance.

I take the produced MailMessage and add all the email addresses in my MailAddressCollection by iterating through the construct. I also do this for all CC'd users.

share|improve this answer
add comment

Your Answer


