I'm trying to send an email and to add some bcc addresses to it.

I don't get an error, I even get the debug statement: "The 1st email was sent successfully." and the email is sent to the email main recipient (i.e. the 'To'). and yet, the email isn't being sent to the bcc addresses.

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.ToAddresses = new String[] {msg.FromAddress};

message.bccAddresses = new String[] {};
message.bccAddresses.add('[email protected]');
message.bccAddresses.add('[email protected]');

Messaging.SingleEmailMessage[] messages = new List < Messaging.SingleEmailMessage > {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);
if (results[0].success) {
    System.debug('The 1st email was sent successfully.');
} else {
    System.debug('The 1st email failed to send: ' + results[0].errors[0].message);

2 Answers 2


You should use the set methods as per the documentation.

message.setBccAddresses(new String[]{'[email protected]','[email protected]'});
  1. I'm not sure if this would be an issue but bccAddresses is a List<String> and not a String [].

  2. Also this can be an issue as per the docs...

    If the BCC compliance option is set at the organization ​level, the user cannot add BCC addresses on standard messages. The following error code is returned: BCC_NOT_ALLOWED_IF_BCC_ COMPLIANCE_​ENABLED. ​Contact your Salesforce representative for information on BCC compliance.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .