Skip to main content

Configure an Email Handler Payload

Build a Payload that receives inbound email and maps email content into Salesforce.

Configure an Email Handler Payload

Use an Email Handler Payload to process messages delivered through Salesforce Email Services. Model the incoming email, add Query and Target Actions, and configure the reply policy through Email Response.

Create and connect the Payload

Create a Payload and choose Email Handler. Select its required Email Action, then configure the Email Services shown for that Payload.

  1. In Salesforce Setup, open Email Services and create or select a service using the package's pylds.EmailService Apex class.

  2. Configure an email address on that service, select the execution user and set the accepted-sender rules required by your organisation. The user must have access to the Payload configuration and the records it processes.

  3. In the Payload's Email Action, add an Email Service entry for the recipient address that incoming messages use.

  4. Activate the Salesforce service and address when you are ready to receive messages, then test from an accepted sender.

There are two parts to routing: Salesforce must deliver the message to the Apex service, and Payloads must match its recipient to an Email Service entry on the Payload. For direct delivery, use the generated Salesforce address. For forwarding through an alias, match the address preserved in the message's To recipients.

In v1.53, Payloads matches To recipients, falling back to the envelope recipient only when the To list is absent or empty. It does not use Cc for matching. Sending a copy to the Salesforce address therefore does not make that address match if a different To recipient is present. Inspect the captured Email data when checking a forwarded message.

Model the email content

In the Email Action, review the incoming email fields that later processing needs. Map the relevant sender, subject, body or other supported email data through the custom editor.

Keep the model focused on values the workflow uses. Confirm whether the process depends on text or HTML content and test actual messages with that format.

Add Queries and Targets

Select a plus button after Email and choose Query or Target. These are the supported optional Action types for Email Handler in v1.53; Flow and child Payload are not offered.

A Query can locate an existing Salesforce record from incoming email data. A Target can create or update the required record. Set Value Source to Payload Data and choose the Email Action or an earlier Query as appropriate.

Order the Actions by their dependencies. For example, find an existing customer before creating a related follow-up Task.

Configure replies

Select Email Response at the end of the sequence. Edit the optional success reply and failure body. Replies are plain text and the settings apply to all Email Services on the Payload.

If several services can match the same message, align their reply policies. Success replies require agreement, and conflicting failure bodies fall back to the default failure message.

Test the actual delivery path

The Payload header's Run Payload control is disabled for Email Handler. Send a controlled message to the configured service address and inspect the resulting Job.

Check service matching, captured email values, Query results, Target writes and reply delivery separately. If no Job appears, investigate Salesforce routing and access before changing field mappings.

Replay of a saved Email Job can help test processing with captured content, but it is not a substitute for testing real inbound and reply delivery.

Did this answer your question?