Why does an Apsona bulk email merge show success but no emails are actually delivered?

This issue occurs when Salesforce blocks the email after the merge completes due to a failure in custom automation, even though Apsona reports the merge action as successful.

In this case, the customer attempted to send bulk mail-merge emails using a formula-based email field and a classic HTML template. Apsona showed that the merge action completed successfully, but no emails were delivered to recipients or to a test inbox, and nothing appeared in spam folders.

During investigation, the Merge Results CSV was downloaded and reviewed. It contained the following error:

System.NullPointerException in EmailMessageTriggerHandler.getRelatedRecordDetails

This revealed that a custom Apex trigger was executing whenever an EmailMessage record was created. The trigger expected certain related record IDs to be present, but one or more of those IDs were null. Because of this, Salesforce aborted the email transaction entirely.

As a result:

  • Apsona successfully generated the emails.

  • Salesforce blocked the send operation.

  • No emails were delivered, even though the merge appeared successful.

To resolve this, the customer was advised to:

  • Ensure that the merge report includes all required related record IDs.

  • Verify logging and attachment settings in the merge wizard.

  • Work with their Salesforce Admin or Developer to update the Apex trigger to include proper null checks.

The specific automation causing the issue was identified as:

  • Trigger: EmailMessageTrigger
  • Class: EmailMessageTriggerHandler
  • Method: getRelatedRecordDetails