Email Services
Email Services is a Setup page where administrators create Apex-based email services that process inbound emails sent to Salesforce-generated email addresses.
Definition
Email Services is a Setup page where administrators create Apex-based email services that process inbound emails sent to Salesforce-generated email addresses. Each email service is backed by an Apex class that parses the incoming email's subject, body, and attachments to create or update Salesforce records automatically.
In plain English
“Here's a simple way to think about it: Email Services is the bridge between an inbound email and your Apex code. Each service has a unique address; mail to it triggers an Apex class that parses the message and creates or updates Salesforce records - turning email into structured data.”
Worked example
The developer at CloudSync creates an Email Service that generates a unique Salesforce email address. When customers email their expense receipts to this address, the Apex handler parses the email, extracts the receipt amount from the subject line, creates an Expense record, and attaches the receipt image, all without any manual data entry.
Why Email Services turn inbound mail into platform events
Email Services is the bridge between an inbound email and your Apex code. Each service has a unique Salesforce-generated address; mail sent to it is parsed by an Apex class you define, which can then create or update any record in the org. It is how a vendor's order-confirmation email becomes an Opportunity, how a support inbox becomes Cases without an integration, how a form-submission email becomes a Lead with rich data extraction.
The reason it's powerful and easy to misuse simultaneously is that the Apex class is yours - and so are the failure modes. Malformed input crashes the handler, and the offending email gets retried, marked as failed, or silently dropped depending on your configuration. Build email services with the same care as a public API: validate inputs, log generously, fail loudly when something doesn't fit the expected shape, and monitor the email service's failure address as if it were on call.
How to set up Email Services
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.
How organizations use Email Services
Built an Email Service that converts vendor order-confirmation emails into Opportunity Line Items automatically; manual data entry eliminated.
Patient-portal email submissions create Cases via Email Services; the Apex class extracts urgency and routes to the right queue.
Lead-capture emails from web forms hit an Email Service that creates Leads with rich field extraction - better than form-to-lead alone.
Trust & references
Straight from the source - Salesforce's reference material on Email Services.
- Email ServicesSalesforce Help
- What Are Email Services?Salesforce Help
Test your knowledge
Q1. Why is understanding Email Services important for Salesforce admins?
Q2. In which area of Salesforce would you typically find Email Services?
Q3. What is the primary benefit of Email Services for Salesforce administrators?
Discussion
Loading discussion…