System.Web.Mail FAQ

Complete FAQ Listing


2.6 How do I specify multiple recipients? Printer Friendly   Email This FAQ   Discuss

To specify multiple recipients for a MailMessage, simply separate each recipient with a semicolon. For example:
mail.To = "me@mycompany.com;him@hiscompany.com;her@hercompany.com";
The following code snippet demonstrates this technique.
 
[ C# ]
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com;him@hiscompany.com;her@hercompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body.";
SmtpMail.SmtpServer = "localhost";  //your real server goes here
SmtpMail.Send( mail );

[ VB.NET ]
Dim mail As New MailMessage()
mail.To = "me@mycompany.com;him@hiscompany.com;her@hercompany.com"
mail.From = "you@yourcompany.com"
mail.Subject = "this is a test email."
mail.Body = "this is my test email body."
SmtpMail.SmtpServer = "localhost" 'your real server goes here
SmtpMail.Send(mail)

 

Discuss This FAQ Item
Got a question? Another Suggestion? Want to post your solution? Discuss it below.
New Post
  • Does it supports Cc and Bcc list    [ Reply ]
    • RE: Does it supports Cc and Bcc list    [ Reply ]
      • RE RE: Does it supports Cc and Bcc list    [ Reply ]
  • Multiple recipients error scenario    [ Reply ]
  • Is sending to multiple recipients limited?    [ Reply ]
  • Getting a email list from a table and sending.    [ Reply ]
    • RE: Getting a email list from a table and sending.    [ Reply ]
    • RE: Getting a email list from a table and sending.    [ Reply ]
  • email + recipient    [ Reply ]
    • RE: email + recipient    [ Reply ]
  • troubleshooting    [ Reply ]
  • How to send an attachment to remote server in asp.net 2003 like yahoo,rediff etc    [ Reply ]
    • RE: How to send an attachment to remote server in asp.net 2003 like yahoo,rediff etc    [ Reply ]
  • email id separator    [ Reply ]
  • Sending and Receiving Email using Asp.net    [ Reply ]
  • Multiple recipients    [ Reply ]
    • RE: Multiple recipients    [ Reply ]
  • Maximum Recipients Allowed    [ Reply ]
    • RE: Maximum Recipients Allowed    [ Reply ]
  • Wrong info about multiple recepient    [ Reply ]
  • outgoing mail server    [ Reply ]
  • Mail Sending in Windows Application    [ Reply ]
  • Microsoft Outlook distribution lists?    [ Reply ]
    • RE: Microsoft Outlook distribution lists?    [ Reply ]
  • VB to C#    [ Reply ]
  • sending attachment to multiple recipients    [ Reply ]
  • Add Method    [ Reply ]
  • Mulitple Mail    [ Reply ]
  • Email    [ Reply ]
    • RE: Email    [ Reply ]