Email-to-Case and Web-to-Case
Inbound channel plumbing: On-Demand Email-to-Case, routing addresses, threading, loop protection, the Web-to-Case daily cap, and when to use an API or a portal form instead.
Simple explanation
On-Demand Email-to-Case turns emails into cases using Salesforce email services. Nothing is installed on premises.
- Customers write to
support@brand.com. The corporate mail server forwards each message to a routing address, a Salesforce-generated email-services address. - Each routing address sets defaults for the cases it creates, such as Origin, Priority, owner or queue, and record type.
- The message is stored as an
EmailMessage, and attachments are stored as Files. - Threading attaches replies to the existing case. Lightning threading combines header-based matching (
Message-ID,In-Reply-To,References) with a secure threading token. It replaces the legacy Ref ID in the subject or body.
Web-to-Case is a generated HTML form that posts straight into Salesforce. It's quick to set up, but it's capped: up to 5,000 cases per 24 hours. Requests above the cap wait in a pending queue (shared with Web-to-Lead) and are processed when the limit allows. It also has no native file attachments. For anything serious, use an Experience Cloud form or an API-backed form instead.
Real-world analogy
Email-to-Case is a mailroom with a franking machine. Every letter that arrives is opened, stamped with a case number and filed, and any reply that quotes the case number goes into the same file.
Web-to-Case is a suggestion box with a daily cap. It's easy for anyone to use, but it can't take parcels (attachments), and on a very busy day the overflow waits for tomorrow.
Worked example
One support inbox per brand and language.
| Mailbox | Routing address defaults |
|---|---|
| support@brand-a.com | Brand A, English, queue A-EN |
| soporte@brand-a.com | Brand A, Spanish, queue A-ES |
| support@brand-b.com | Brand B, queue B |
- A customer emails
support@brand-a.com. Exchange forwards it to the A-EN routing address, and a case is created with Origin Email and Brand A. - The auto-response sends the acknowledgement, and the outbound email carries the threading headers and token.
- The customer replies from a phone that strips some headers. The token still matches the reply to the same case.
- A vendor's out-of-office reply would create a loop. The auto-response rule excludes auto-submitted messages and the company's own domains, and a Flow guard flags more than 5 cases from one sender within 10 minutes.
Diagram
Key points
- On-Demand Email-to-Case is the standard approach: corporate mailbox β forwarding β routing address β case +
EmailMessage. - Daily processing limit for all email services combined (Email-to-Case included): user licences Γ 1,000, up to 1,000,000 messages. Over-limit mail is bounced, discarded or queued, depending on the failure-response settings.
- Per-email size is capped at roughly 25 MB, including attachments β verify current figure.
- Lightning threading (headers + token) is the secure replacement for Ref ID. Don't thread on the subject line.
- Web-to-Case: 5,000 cases per 24 hours; excess requests wait in a pending queue; no native attachments; add reCAPTCHA.
- Route with routing-address defaults plus queues and Omni-Channel. Plan auto-response and loop controls from day one.
Limits and gotchas
- Storage.
EmailMessagerows and attachments are often the largest storage consumers in a service org, so include them in the archive policy. - Loops between your auto-response and another system's auto-reply can create thousands of cases overnight. Exclude auto-submitted mail and your own domains, rate-limit by sender, and monitor case-creation spikes.
- Ref ID β Lightning threading was a release update. Integrations that compose emails outside Salesforce and rely on Ref ID need the token approach (
EmailMessages.getFormattedThreadingToken). - Routing addresses must be verified. Sandbox email-services addresses don't carry over to production.
- Web-to-Case isn't an integration API: no attachments, a daily cap and spam exposure. Use an Experience Cloud form or the REST API for anything strategic.
π€ How to say this in an interview
"Email-to-Case is On-Demand: the corporate mailbox forwards to a routing address per brand or language, and each address sets the defaults that seed routing. Threading uses headers plus the Lightning token, not the subject line. I size the daily volume against the licence-based limit, put EmailMessages and files in the archive policy, and design loop protection before go-live. Web-to-Case is fine for a simple form, but its 5,000-a-day cap and lack of attachments push me to an Experience Cloud or API-backed form at scale."
Common follow-ups
How do you stop an auto-reply loop?
Use layers. Prevent it: auto-response criteria exclude Auto-Submitted mail, no-reply senders and your own domains. Detect it: a Flow or scheduled job counts new cases per sender in a short window and quarantines the sender or deactivates the routing address. Contain it: deactivate the routing address, then bulk-close or hard-delete the spam cases after review. Monitor for case-creation spikes.
Why not just use Web-to-Case for the customer portal?
It's capped at 5,000 cases per 24 hours, it can't take attachments, the customer isn't authenticated, and it's a spam target. An Experience Cloud form gives authenticated users, case deflection, attachments and sharing. For a custom front end, a REST API call through an integration user or an Experience Cloud API is the robust option.