MailShrink operates directly on production email storage. Security and data integrity are the project's highest priorities.
- MailShrink must run as root or as the user who owns the mail files
- The tool never opens network connections and never transmits data
- All operations are local to the filesystem
- Atomic operations: Compression writes to a temporary file first; the original is only replaced after successful compression via atomic
rename(2) - No data deletion: MailShrink never deletes email messages — it only compresses them
- Metadata preservation: File modification time (mtime = IMAP INTERNALDATE), ownership (UID/GID), and permissions are preserved
- Maildir locking: Advisory file locks prevent concurrent access by Dovecot during compression
- Dry-run by default: The
compresscommand requires explicit--applyto modify any files - Skip-on-error: If any individual file fails to compress, it is skipped and the original remains untouched
MailShrink is designed for Linux servers running Dovecot with the zlib plugin enabled. It is tested on:
- cPanel/WHM servers
- DirectAdmin servers
- Custom Dovecot + Exim/Postfix setups
If you discover a security vulnerability, please report it responsibly:
- Do not open a public GitHub issue
- Email: security@nemanja.io (or use GitHub's private vulnerability reporting)
- Include:
- A description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
We will acknowledge receipt within 48 hours and aim to provide a fix within 7 days for critical issues.
Before using MailShrink on production data:
- Back up your mail storage before the first run
- Test on a staging server or a small subset of mailboxes first
- Verify Dovecot's zlib plugin is enabled and configured
- Run
mailshrink analyzefirst to understand the scope - Use
mailshrink compresswithout--applyto see what would happen - Start small — compress one account's Sent folder before doing a full run