๐๏ธ Retention Policies
October 24, 2025 ยท View on GitHub
โ Back to Documentation Index
Overview
Mail Archiver provides comprehensive retention policy management to help you control storage usage while maintaining compliance requirements. The system supports two types of retention policies:
- Server Retention Policy: Controls automatic deletion of emails from the mail server
- Local Archive Retention Policy: Controls automatic deletion of emails from the local archive
This dual approach gives you fine-grained control over storage management while ensuring data consistency and compliance requirements are met.
Key Features
- Automatic Cleanup: Automatic deletion of old emails during sync cycles
- Detailed Logging: Comprehensive audit trail of all deletion activities
- Per-Account Configuration: Configure retention policies individually for each email account
Server Retention Policy
Purpose
The server retention policy automatically deletes emails from the mail server after a specified number of days.
Configuration
- Field:
Delete After Days - Location: Email Accounts โ Edit โ Email Deletion section
- Values: Number of days (empty = disabled)
How It Works
- During synchronization, the system identifies emails older than the configured retention period
- Identified emails are marked for deletion on the mail server
- Deletion is performed using IMAP EXPUNGE command
Requirements
๐จ Important note for retention policies
- Requires IMAP Expunge support from the mail server to permanently delete emails
- For Gmail accounts, Auto-Expunge must be disabled in Gmail settings under the "Forwarding and POP/IMAP" tab! (See Gmail Best Practices for more details)
Local Archive Retention Policy
Purpose
The local archive retention policy automatically deletes emails from the local archive after a specified number of days.
Configuration
- Field:
Local Retention Days - Location: Email Accounts โ Edit โ Email Deletion section
- Values: Number of days (empty = disabled, must be โฅ Server Retention)
How It Works
- During synchronization, the system identifies archived emails older than the configured retention period
- Identified emails are deleted from the local database
- Associated attachments are also removed
- A summary log entry is created in Access Logs
Validation Rules
- Server Retention Required: Local retention can only be configured if server retention is also set
- Retention Hierarchy:te Local rention days must be greater than or equal to server retention days
- Safety First: This prevents emails from being deleted from the local archive before they are deleted from the mail server
Configuration Steps
1. Edit Email Account
- Navigate to Email Accounts โ Edit Account
- Scroll to the Email Deletion section
- Set Delete After Days (server retention)
- Set Local Retention Days (local archive retention)
- Save the configuration
Monitoring and Logging
Access Logs
All retention policy deletions regarding the local archive are logged in the Access Logs with detailed information:
Best Practices
Compliance Considerations
-
Legal Requirements:
- Research retention requirements for your industry
- Document retention policies
- Regular compliance audits
-
Audit Trails:
- Maintain detailed Access Logs
- Regular log analysis
- Export logs for external audits
-
Documentation:
- Maintain retention policy documentation
- Regular policy reviews
- Stakeholder approvals