Optimized email attachment storage and GDPR compliance
Reduce Salesforce storage costs and ensure data privacy with intelligent attachment handling. F104671 | 2026-05
Introduction
Previously, sending emails with attachments to multiple recipients resulted in redundant file storage, as a separate copy was created for every recipient. Additionally, large-scale email campaigns could hit Salesforce sharing limits, causing silent failures in record creation, while deleted emails often left orphaned attachments behind. This update introduces intelligent attachment management to eliminate redundancy, prevent sharing limit issues, and ensure full GDPR compliance during data cleanup.
Who is this feature relevant for?
- Recruitment Consultants
- System Administrators
- Data Protection Officers
Benefits at a glance
- Reduced Storage Costs: Identical attachments are reused across recipients and send actions, significantly lowering Salesforce document storage usage.
- Improved Reliability: Automatic handling of file sharing limits ensures that EmailMessage and Task records are always created, even during bulk sends.
- Enhanced GDPR Compliance: Attachments are cleaned up when a person is anonymized, and by a scheduled cleanup job, provided they are no longer needed for other records.
Feature explanation
The system now intelligently manages how email attachments are stored and shared within Salesforce. When an email is sent, the application automatically checks if an identical file already exists in the system by comparing its file content (checksum) and its file name. If a match is found and it has not reached its sharing capacity, the system links the existing file to the new email instead of creating a duplicate. This process happens seamlessly across all email paths, including manual sends, automated flows, and status-triggered notifications.
To ensure system stability, the update also introduces proactive management of Salesforce's file sharing limits. If a specific document is approaching the maximum number of allowed links, the system will automatically create a new copy to continue the send process without interruption. This prevents the previous issue where emails were sent but the corresponding activity records failed to save.
Finally, the cleanup of email attachments has been strengthened to support data privacy requirements. When a person is anonymized through the GDPR process, the system evaluates the attachments of their emails. If an attachment is no longer linked to any other emails or records, it is deleted from the system. This ensures that personal or sensitive documents do not remain in storage longer than necessary. Attachments of an email that a user deletes manually are not removed at that moment. They are removed by the scheduled cleanup job described under Set-up / Implementation time.
Set-up / Implementation time
The storage optimization is active by default for all email sending paths after the release. The cleanup of attachments that are no longer linked to anything needs a scheduled job. The job is not scheduled automatically, so a system administrator has to schedule the Apex class EmailAttachmentCleanupBatchScheduler (Setup > Apex Classes > Schedule Apex), for example once a day outside working hours. Without this job, only the GDPR anonymization removes email attachments.