function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
timomertimomer 

Add multiple addresses to CC

Hello,

 

im following the code example on this page: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_outbound.htm

 

i wish for there to be two address on the CC, but, when adding them I get  "INVALID_EMAIL_ADDRESS"

 

one address works fine, when separating the address I have tried "," and ";" - both cause an error.

 

In what format should I pass the string of address to mail.setCcAddresses?

 

Many thanks,

tim

Best Answer chosen by Admin (Salesforce Developers) 
JimRaeJimRae

You need to use a String array to pass the addresses.

Like the sample shows:

 

String[] ccAddresses = new String[] {'user@acme.com','support@acme.com'}; mail.setCcAddresses(ccAddresses);

 

 

All Answers

JimRaeJimRae

You need to use a String array to pass the addresses.

Like the sample shows:

 

String[] ccAddresses = new String[] {'user@acme.com','support@acme.com'}; mail.setCcAddresses(ccAddresses);

 

 

This was selected as the best answer
timomertimomer
thank you for that, i was passing it as one string