Email attachment behavior is a mix of org settings, channel limits, and storage hygiene. The steps below cover the rollout of attachment handling for a new use case from initial configuration to long-term storage management.
- Confirm Enhanced Email is on
Setup > Email > Enhanced Email. Check the activation status. If off and the org predates 2017, plan the activation as a separate project; it changes the underlying data model for all email.
- Identify the channels
List which channels will produce attachments: Email-to-Case, Apex email handlers, List Email, Outlook/Gmail integration. Each has its own limits and storage path.
- Test inbound limits
Send a test message with attachments of varying sizes to confirm the 25 MB cap behavior. Verify the bounce message format so support knows how to triage user complaints.
- Test outbound limits
Compose a test email with attachments exceeding 10 MB per file and confirm the error appears in the composer. Train end users on the limits before rolling out.
- Configure storage audit query
Build a SOQL query: SELECT Id, Title, ContentSize FROM ContentVersion WHERE FirstPublishLocationId IN (SELECT Id FROM EmailMessage) ORDER BY ContentSize DESC. Save it as a scheduled report.
- Set retention rules
Define how long email attachments are retained. Common rules: 90 days for Case attachments, 1 year for Opportunity attachments, indefinite for compliance objects. Document the rule clearly.
- Schedule the cleanup
Build an Apex batch or scheduled Flow that deletes ContentVersion records older than the retention window. Test in sandbox; production deletes are irreversible after the Recycle Bin window.
Default modern mode. Email attachments stored as ContentDocument. Recommended for any new org.
Pre-2017 mode. Email attachments stored as Attachment on the Activity. Migrate to Enhanced Email if still active.
Setting on the Email-to-Case service that controls which Case the attachment lands on. Affects how Files appear in the Case Files related list.
Custom code that decides where binaryAttachments and textAttachments are saved. Common pattern: save as ContentVersion linked to the parent record.
Per-user setting on the integration. Controls whether attachments are uploaded to Salesforce with the logged email.
- The 25 MB cap is per inbound message total, not per attachment. Five 6 MB files in one message bounces; one 24 MB file is fine.
- Apex handlers receive binaryAttachments and textAttachments separately. Code that only processes the first silently drops .txt and .csv attachments.
- Enhanced Email cannot be turned off once activated. Plan the activation carefully because the underlying storage model changes permanently.
- Outlook/Gmail integration applies the user's mail client size limit before Salesforce sees the message. Users hitting issues may need to check their mail client first.
- Storage cleanup deletes ContentVersion, which deletes the file. There is no easy way to selectively delete email attachments; the cleanup must filter accurately to avoid deleting other Files.