Email Services route inbound email to Apex handlers — "when an email lands at this address, run this Apex class." Useful for custom Email-to-Case logic, ticket-creation from forwarded emails, or any inbound-email workflow that goes beyond standard Email-to-Case.
- Open Setup → Email Services
Setup gear → Quick Find: Email Services → Email Services.
- Click New Email Service
Top-right.
- Set Email Service Name and Active checkbox
Inactive services don't accept email.
- Pick the Apex Class
Must implement Messaging.InboundEmailHandler. The class's handleInboundEmail method runs when email arrives.
- Configure security settings
Accept Attachments: All / Plain Text Only / None. Authenticate Senders: tick to require SPF / DKIM authentication.
- Set Failure Response Settings
Bounce / Discard / Forward / Hold. What happens when the Apex handler fails.
- Save → click into the Email Service → New Email Address
Generate a unique inbound address. The full address is `<localpart>@<id>.in.salesforceemail.com` or a custom domain.
- Provide that address to your senders
External senders email this address; the Apex class processes each inbound message.
Implements Messaging.InboundEmailHandler. Required.
All / Text only / None. Drives whether the Apex class receives attachment payloads.
Require SPF / DKIM authentication. Recommended for production.
Bounce / Discard / Forward / Hold. What happens when the handler errors.
- Email Services have daily limits per org — beyond the limit, additional emails are bounced. Monitor Setup → Email Services → Usage.
- Inbound email is processed in the context of the Apex class — not a real user. Sharing rules and field permissions in the Apex must be explicit; the class runs in system mode unless you restrict it.
- Bounced senders see a generic Salesforce error message. For custom error responses, build a Failure Response = Forward to a monitored mailbox.