none
SPUtility.SendEmail send email to multiple users RRS feed

  • Question

  • Hello ,

     I have write the following code to send emails to multiple users :

      StringDictionary headers = new StringDictionary();
     headers.Add("to", "Test1@gmail.com;Test2@gmail.com");
    headers.Add("subject", "aaa");
    headers.Add("content-type", "text/html");
    SPUtility.SendEmail(web, headers,"aaa");

    Test1 just recieved an email and Test2 not .

    So How can I send to multiple users?


    ASk

    Thursday, November 1, 2012 8:15 AM

Answers

  • headers.Add("to", "Test1@gmail.com,Test2@gmail.com");

    Just replace semi-colon with coma and try it out. It should work.

    Thanks, Bhadr :) Mark as Answer if it solves your problem. Vote As Helpful if the post is helpful for you.

    Thursday, November 1, 2012 9:16 AM
  • Better You use System.Net.Mail to send mails to Multiple addresses.

    It will work for you.

    Regards,

    Rahul

    Thursday, November 1, 2012 9:27 AM

All replies

  • headers.Add("to", "Test1@gmail.com,Test2@gmail.com");

    Just replace semi-colon with coma and try it out. It should work.

    Thanks, Bhadr :) Mark as Answer if it solves your problem. Vote As Helpful if the post is helpful for you.

    Thursday, November 1, 2012 9:16 AM
  • Better You use System.Net.Mail to send mails to Multiple addresses.

    It will work for you.

    Regards,

    Rahul

    Thursday, November 1, 2012 9:27 AM