470,829 Members | 1,876 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,829 developers. It's quick & easy.

C# Web Help with sending E-mail to multiple recipients

I am not able to get an e-mail sent to multiple recipients. I am using C# in VS 2003.

Here is the code:

MailMessage mail = new MailMessage();
mail.To = "address1@somewhere.com;address2@somewhere.com ";
mail.Cc="address3@somewhere.com";
mail.From = "My Program";
mail.Subject = "Alert";
mail.Priority = MailPriority.High;
mail.BodyFormat = MailFormat.Text;
mail.Body = sMessage;
SmtpMail.SmtpServer = "mymailserver.somewhere.com";
SmtpMail.Send(mail);

When using this the message gets sent to address1 and address3 but not address2. I have also tried using a comma in place of the semicolon with no luck. I am at a loss as I get no error message and everything I have looked up says that this is correct and should work. Any help would be apprectiated.

Thanks
Nate
Mar 28 '08 #1
2 2268
Plater
7,872 Expert 4TB
Well the MSDN on that isn't very good since they obsoleted it.
Their examples don't seem to lend it as a possibility that you can do multiple recipients though.
However using trickery I found this:
[quote=MSDN for System.Web.Mail.MailMessage.To]
Property Value
A semicolon-delimited list of e-mail addresses.
[/code]

Are your addresses all valid?
Mar 28 '08 #2
kenobewan
4,871 Expert 4TB
This does work, I'd guess that Plater is right the problem is with the email address3. Try replacing it with your own - in fact you may want to ensure none of them are live or you may get accused of spamming :).
Mar 29 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by NotGiven | last post: by
1 post views Thread by rich | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.