none
Multiple BCC in MailAddress RRS feed

  • Question

  • Hi,

    I have this line:

    mail_message.CC.Add(new MailAddress("employee_1_email@company.com", "Employee_1 Name"));
    mail_message.CC.Add(new MailAddress("employee_2_email@company.com", "Employee_2 Name"));

    I am moving the employee name and emails to a database, table name receipt_recipients with two fields:

    1. employee_name
    2. employee_email

    I want to populate the above Add MailAddress from the database table. Is it possible to add all in one line with semicolon just like when sending from any email client or the only way is to loop through records and add separate Add MailAddress?

    Thanks,

    Jassim


    Monday, February 22, 2016 8:43 PM

Answers

  • You can add multiple e-mail addresses at a time using the overload of MailMessage.CC.Add that takes a String (not a MailAddress) as its argument. The String can contain a list of e-mail addresses separated by a comma "," (not a semi-colon).

    mail_message.CC.Add("employee_1_email@company.com,employee_2_email@company.com");

    I don't think that this version allows you to include names as well as e-mail addresses.

    Monday, February 22, 2016 9:21 PM

All replies