PranavNagrecha/AwesomeSalesforceSkills / skills/admin/email-to-case-configuration
email-to-case-configuration
VerifiedConfiguring Salesforce Email-to-Case: Standard vs On-Demand mode selection, routing address setup, email threading via Lightning tokens, auto-response rules, attachment limits, and per-address case field defaults. Trigger keywords: email-to-case, routing address, on-demand email-to-case, email threading, case from email, email agent, routing address setup, Case.settings-meta.xml, EmailToCaseRoutingAddress, emailServicesAddress, isVerified, caseOrigin, enableThreadTokenInBody, useEmailHeadersForThreading, overEmailLimitAction, unauthorizedSenderAction, enableE2CAttachmentAsFile, saveEmailHeaders, newEntityRecordType, casePriority, EmailMessage.EmailRoutingAddressId, auto-response loop. NOT for the wider case layer (queues, escalation rules, case teams, entitlements) - use admin/case-management-setup. NOT for routing case work items to agents after creation - use admin/omni-channel-routing-setup. NOT for the email templates or letterheads themselves - use admin/email-templates-and-alerts.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 32.3 KB |
| references/examples.md | markdown | 6.0 KB |
| references/gotchas.md | markdown | 24.4 KB |
| references/llm-anti-patterns.md | markdown | 8.4 KB |
| references/metadata-examples.md | markdown | 18.6 KB |
| references/well-architected.md | markdown | 11.1 KB |
| scripts/check_email_to_case_configuration.pyexecutable | script | 27.9 KB |
| templates/email-to-case-configuration-template.md | markdown | 3.6 KB |
references/well-architected.md
View on GitHub# Well-Architected Notes — Email-to-Case Configuration
## Relevant Pillars
- **Reliability** — Email-to-Case is a critical inbound channel. Misconfigured threading means customer replies create duplicate cases, causing agents to work in parallel on the same issue. Unverified routing addresses silently drop inbound email. Both failures are invisible to the customer and degrade support reliability. On-Demand mode relies on Salesforce infrastructure availability; Standard mode adds a local agent as a reliability dependency.
- **Security** — Standard Email-to-Case keeps email content inside the corporate network before case creation, which matters for orgs with strict data classification requirements. On-Demand routes email through Salesforce infrastructure. The choice must be deliberate and documented. Auto-response rule loops can expose the org's case creation endpoint to abuse if an external sender can trigger unbounded case creation.
- **Operational Excellence** — Routing address verification, mail server forwarding rules, threading tests, and auto-response loop prevention must all be validated before go-live and documented in the org runbook. Multiple routing addresses per org must be inventoried so that changes to mail server configuration do not silently break specific channels.
- **Performance** — Standard Email-to-Case consumes API calls per email. High-volume orgs using Standard mode must account for this in API budget planning. On-Demand uses Apex Email Services and does not consume API calls, making it the more scalable choice for high-volume inbound channels.
## Architectural Tradeoffs
**On-Demand vs Standard:** On-Demand is simpler to operate, requires no local infrastructure, does not consume API calls, and scales with Salesforce's email infrastructure. The tradeoff is that email content routes through Salesforce infrastructure before case creation. Standard keeps email internal but adds an agent server as a single point of failure and consumes API calls. Choose Standard only when data residency or content classification policy explicitly requires it.
**Single vs multiple routing addresses:** A single routing address is simpler to maintain but cannot differentiate inbound channels at creation time. Multiple routing addresses allow per-channel defaults and queue routing but multiply the number of mail server forwarding rules, verification records, and monitoring points. Design for the minimum number of routing addresses that meets the business's channel differentiation requirement.
**Auto-response on Email-to-Case vs outbound email on case creation:** Auto-response rules are simple and require no automation. However, they depend on assignment rule execution and cannot be triggered selectively (e.g., only for certain case origins). Flow-based outbound email actions give more control over when and to whom the confirmation is sent, at the cost of additional automation to maintain.
## Anti-Patterns
1. **Unverified routing addresses in production** — Creating routing addresses and completing mail server forwarding without verifying the Salesforce-side address results in silent case creation failures. All inbound email is delivered but no cases are created. This is an operational excellence anti-pattern: there is no monitoring, no alert, and no user-facing error. Always verify routing addresses before configuring mail server forwarding rules.
2. **Assuming On-Demand and Standard are equivalent in all scenarios** — Treating the mode choice as a cosmetic preference rather than an infrastructure and security decision causes post-go-live surprises: attachment rejections under On-Demand for files that worked under Standard, or data residency audit findings when email content was expected to remain internal. Document the mode selection rationale in the org's architecture decision record.
3. **Relying on email threading without end-to-end testing through the production mail gateway** — Testing threading in sandbox bypasses the corporate email gateway. Production gateways often modify email content in ways that strip Lightning thread tokens. Discovering this failure after go-live means all customer replies have been creating new cases — sometimes for days — before the issue is detected. End-to-end gateway testing is a reliability requirement, not an optional step.
4. **Treating `settings/Case.settings-meta.xml` as a file you hand-write rather than one you retrieve** — the file is org state, not a template. `routingAddresses` is a full-replacement list, so a hand-assembled or pipeline-templated subset deletes the channels it does not mention, and the read-only `emailServicesAddress` cannot be restored afterwards. The forwarding rules then point at addresses that no longer exist. This is an operational excellence failure with a reliability blast radius: an entire support channel goes dark and the first signal is a customer complaint. Retrieve, edit, deploy — and diff the routing address count in CI.
5. **Configuring refusal behaviour by accident** — `unauthorizedSenderAction` and `overEmailLimitAction` are easy to leave at whatever the org has, and both accept `Discard`. A discarded message produces no Case, no EmailMessage, no bounce and no log, so the org cannot answer "did our customer's email reach us?" — a question that eventually gets asked under contractual or regulatory pressure. Choose `Bounce` or `Requeue` deliberately and record the decision; `Discard` is a considered choice for an address under attack, not a default.
## Official Sources Used
- Salesforce Help: Set Up Email-to-Case — https://help.salesforce.com/s/articleView?id=sf.setting_up_email_to_case.htm
- Salesforce Help: Email-to-Case Limits and Limitations — https://help.salesforce.com/s/articleView?id=sf.email_to_case_limits.htm
- Salesforce Help (KB 000386265): Attachment size limit for On-Demand Email-to-Case — https://help.salesforce.com/s/articleView?id=000386265&type=1 — 35 MB total redirected message (body + attachments + HTML); up to 33% MIME encoding inflation, giving an effective attachment ceiling of ~25 MB; 25 MB was the total before Winter '21 and 10 MB before Summer '14
- Salesforce Help: Auto-Response Rules — https://help.salesforce.com/s/articleView?id=sf.creating_auto-response_rules.htm
- Salesforce Help: Assignment Rules — https://help.salesforce.com/s/articleView?id=sf.creating_assignment_rules.htm
- Salesforce Well-Architected Overview — https://architect.salesforce.com/docs/architect/well-architected/guide/overview.html
- Metadata API Developer Guide, `CaseSettings` → `EmailToCaseSettings` (PDF v62) — https://resources.docs.salesforce.com/262/latest/en-us/sfdc/pdf/api_meta.pdf — the element names and enums used throughout `references/metadata-examples.md`: `enableEmailToCase` (and the note that it can't be disabled once on), `enableOnDemandEmailToCase`, `enableE2CAttachmentAsFile`, `enableE2CDeduplicateAttachments`, `enableE2CSourceTracking`, the two mutually exclusive threading pairs (`enableThreadTokenInBody/Subject` for Lightning Threading, `enableThreadIDInBody/Subject` for orgs without it), `useEmailHeadersForThreading`, `notifyOwnerOnNewCaseEmail`, `preQuoteSignature`, and the `EmailToCaseOnFailureActionType` values behind `overEmailLimitAction` (Bounce/Discard/Requeue) and `unauthorizedSenderAction` (Bounce/Discard) — gotchas 8, 9, 10, 11
- Metadata API Developer Guide, `CaseSettings` → `EmailToCaseRoutingAddress` (PDF v62) — https://resources.docs.salesforce.com/262/latest/en-us/sfdc/pdf/api_meta.pdf — the per-address fields and the two behaviours that drive gotchas 6, 7, 12 and 13: `caseOwner` "sets a value of `defaultCaseOwner` in `CaseSettings`", `routingAddresses` "Removing an address from this list deletes it from the target org", `emailServicesAddress` and `isVerified` are read-only, `saveEmailHeaders`, `authorizedSenders`, `createTask` / `taskStatus`, `addressType` (EmailToCase / Outlook), `isPermsetControlled` (API 61.0+), `routingFlow` and `fallbackQueue` (API 56.0+), `newEntityRecordType` (api_meta L112078 — no version note and no value format, which is the grounding for the UNVERIFIED markers in gotcha 14), and `casePriority` (api_meta L112039 — "Specifies the default case priority", carrying no Required marker, which is the grounding for the UNVERIFIED marker in gotcha 15). The guide's own sample definition sets `casePriority` on both of its routing addresses (api_meta L112187, L112200)
- Metadata API Developer Guide, `CaseSettings` Declarative Metadata Sample Definition and package manifest (PDF v62) — https://resources.docs.salesforce.com/262/latest/en-us/sfdc/pdf/api_meta.pdf — the shape the `Case.settings-meta.xml` example in `references/metadata-examples.md` is built from, the `Settings` / `Case` manifest member, and the statement that the `*` wildcard "applies only when retrieving all settings, not for an individual setting"
- Object Reference for the Salesforce Platform, `EmailMessage` (PDF v62) — https://resources.docs.salesforce.com/262/latest/en-us/sfdc/pdf/object_reference.pdf — the verification queries and gotcha 8: `ParentId` ("ID of the case that's associated with the email"), `Incoming`, `Headers` ("The Internet message headers of the incoming email … Doesn't apply to outgoing emails"), `EmailRoutingAddressId` ("set when the email is processed by Email-to-Case service"), `ValidatedFromAddress`, and `ThreadIdentifier` — "This field is not used by On-Demand Email-to-Case"
- Object Reference for the Salesforce Platform, `Case` and `EmailRoutingAddress` (PDF v62) — https://resources.docs.salesforce.com/262/latest/en-us/sfdc/pdf/object_reference.pdf — that `Case.Origin` is the field `caseOrigin` populates, that the Case field list contains no routing-address field (`Case.SourceId` is "The ID of the social post source"), that `Case.SuppliedEmail` is what ties duplicate cases in a loop back to one sender, and that `EmailRoutingAddress` (`PersonalName`, `Address`, `EmailServicesAddress`) is admin-only and requires Email-to-Case to be enabled
- Live org validation (dry-run `sf project deploy validate`, `checkOnly`, API 67.0, 2026-09-12) — the source for gotchas 14 and 15, each marked UNVERIFIED against the guide because the guide is silent: `Property 'newEntityRecordType' not valid in version 63.0` (rejected at 62.0 and 63.0, accepted at 64.0), `In field: newEntityRecordType - no RecordType named Support found` for a bare developer name where `Case.Support` resolves, and `EmailToCaseRoutingAddress[support@acme.example]: Missing casePriority` for an address with no `casePriority`. Org behaviour is not an official source; it is recorded here as the evidence behind three checker rules (`E2C-RT-01`, `E2C-RT-02`, `E2C-PRI-01`) and re-checked against the guide before either claim is treated as permanent
- Salesforce Developer Limits and Allocations Quick Reference (App Limits Cheat Sheet, PDF v62) — https://resources.docs.salesforce.com/262/latest/en-us/sfdc/pdf/salesforce_app_limits_cheatsheet.pdf — checked for a daily Email-to-Case limit and an inbound size limit; it contains neither. The only adjacent figure is "Email services heap size is 50 MB". This is the grounding for the UNVERIFIED marker on the daily limit in gotcha 9 — the number must be read from the org, not quoted
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |