Without the relevant code fragments, we have to make guesses...
You can't separate email addresses with a comma - if you want to send the same message to different people, then
1) Send it to one of them and CC (or BCC) the other
2) Send the message twice.
3) Use the MailMessage.To.Add method for two different new MailAddress instances.
You can't separate email addresses with a comma - if you want to send the same message to different people, then
1) Send it to one of them and CC (or BCC) the other
2) Send the message twice.
3) Use the MailMessage.To.Add method for two different new MailAddress instances.
You can add several addresses using a comma separated list. For example the following should work fine:
System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();
mm.To.Add("aaa@bbb.ccc, ddd@eee.fff");
However if there's even one invalid address, you'll get an exception. Also note that the exception isn't necessarily coming from the recipient address, it could also come from the sender address.
So without seeing the actual code the best option is to debug through the code and see what's going wrong.
Also note that what OriginalGriff wrote, it would be best to add a single recipient at a time. When done in a loop using a proper try..catch block you can decide what to do when an invalid address is encountered. If you add them all together, it'll be harder to catch the problematic address and to continue with other addresses if that's needed.
So without seeing the actual code the best option is to debug through the code and see what's going wrong.
Also note that what OriginalGriff wrote, it would be best to add a single recipient at a time. When done in a loop using a proper try..catch block you can decide what to do when an invalid address is encountered. If you add them all together, it'll be harder to catch the problematic address and to continue with other addresses if that's needed.
I faced this problem while sending email to multiple email address. I used the delimiter ";" to separate the email addresses. As outlook uses the same format of separating multiple email addresses. But it didnot worked.Instead of using the ";" we should use the "," for separating the multiple emails. And this worked for me.
For more details :
visit: http://kopila.com.np/
For more details :
visit: http://kopila.com.np/
No comments:
Post a Comment