0
votes

i have set a BCC address like this but it does not go out

 Contact con1 =  new Contact();
 con1.FirstName = 'Anil';
 con1.LastName = 'Dutt';
 con1.Email = '[email protected]';
 insert con1;

 Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
 mail1.setTargetObjectId(con1.Id);
 mail1.setWhatId(opp.Id);
 mail1.setTemplateId('00Xd0000000PJGH');
 String[] bccEmail = new String[]{'[email protected]'};
 mail1.setBccAddresses(bccEmail);
 Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail1 });
 delete con1;

Mail goes to [email protected] but not to [email protected]

i tried mail1.setBccSender(true) but also not working

No error and BCC compliance is also not enabled

Any idea?

Thanks

1
Just changed your email addresses so you don't get spam!Matt Lacey
mail1.setBccSender(true) actually works, the problem was some otherAnil D

1 Answers

3
votes

From the table of SingleEmailMessage Methods:

setBccAddresses

A list of blind carbon copy (BCC) addresses. The maximum allowed is 25. This argument is allowed only when a template is not used.

Emphasis mine. Hope this helps.