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

Sendemail Plugin to perform TO, CC & BCC

Is there a way to include multiple recipients using the Sendemail plugin?  I'm looking to have multiple email addresses on the TO line with the option to have a CC or BCC.


Thanks in advance.




Have you tried passing it a variable that contains multiple comma-delimited addresses? I haven't tried it, and obviously it wouldn't grant true CC or BCC functionality, but it might work for sending to multiple TOs.


I tried commas, spaces and semi-colons which all produce an error.  Accidentally, during testing I sent a blank TO field which gave me this error:  "SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing target address (target, to, cc, bcc):"


That prompted me to think this functionality is available.  I'm just missing the logic to build it in.





If you are referring to the SendEmail Plugin in the pack, that supports just 1 email address.

However, it should be relatively simple to change it to inlude a list of CC address.


THe following are the changes you need to make

1. Change the input parameters to the plugin (describe and invoke) to include a ccAddress of type String

2. Pass the ccAddress in a comma separated list

3. In Apex parse the ccAddress to get a list of email addresses - this is simple using the spli() method

4. Change the sendEmail method in the plugin to accept the ccAddressList

5 on the  Messaging.SingleEmailMessage message object call the method setCcAddresses with your list.




Hope this helps..



Viola, ahahah that sounds so easy...Oh, if only I was an APEX programmer life would be great right about now.  I'll have to wait for version 2 of the Sendemail plugin from the starter pack to be released.