Salesforce recently stopped creating email activity records for emails which failed because they bounce.

Below is the error I am getting:

SendEmail failed. First exception on row 0; first error: EMAIL_ADDRESS_BOUNCED, The target object email address is currently marked as bounced.: [targetObjectId, ...]

When I use the below code:

public static Messaging.SendEmailResult sendEmail(Id whatId, Id emailTemplateId, String emailTemplateDeveloperName, String orgWideEmailId, Id targetObjectId, String emailAddress, Boolean saveActivity) {

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

    if (String.isNotBlank(emailTemplateId)){


    } else if (String.isNotBlank(emailTemplateDeveloperName)){


    if (String.isNotBlank(whatId)){

    if (String.isNotBlank(targetObjectId)){


    } else if (String.isNotBlank(emailAddress)) {

        mail.setToAddresses(new String[] {emailAddress}); 

    if (String.isNotBlank(orgWideEmailId)){


    Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage>();

    Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);


    return results[0];

private static void handleEmailResults(Messaging.SendEmailResult[] results) {

    for(Messaging.SendEmailResult result :results) {                

        if(!result.IsSuccess()) {                    
            List<Messaging.SendEmailError> errors = result.getErrors();
            if (errors.size() > 0){
                Messaging.SendEmailError err = errors[0];

I've doubled checked, and setSaveAsActivity is definitely being set to true


  1. Why aren't the email activities being created?
  2. What can I do to fix it?

1 Answer 1


Why aren't the email activities being created?

Emails that fail to send are not saved as an activity. For example, if it is missing a subject, recipient, etc, it will not be saved anywhere.

What can I do to fix it?

You need to check if it failed, and manually save activities if you want to record the activity.

  • 1
    OK, so it will send the first email, then once Salesforce gets the bounce back the contact is marked as Bounced and the email activity for the first email gets the little exclamation icon, but all subsequent emails fail to even send because the contact is marked as Bounced and Salesforce automatically rejects them?
    – Robs
    Jul 25, 2019 at 14:56
  • 2
    @Robs Correct. Bounce Mail Management is designed to prevent you from sending emails to bounced emails. This is particularly useful for Mass Email, since you'd normally be "charged" against your 5,000 emails/day limit, but emails blocked this way don't count.
    – sfdcfox
    Jul 25, 2019 at 15:44
  • If I manually create an email activity record will it automatically be marked as bounced with the useful exclamation icon because the related contact is marked as bounced?
    – Robs
    Jul 25, 2019 at 15:46
  • 1
    @Robs I think so? The docs aren't clear on this, and I don't have time to set it up and test it today.
    – sfdcfox
    Jul 25, 2019 at 15:52
  • Thanks. No need to build it for me, just wondering if you already knew :)
    – Robs
    Jul 25, 2019 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.