The popular IMAP server Dovecot supports compression incoming Mails in order to save disk space on the server.
This feature can be enabled by using the zlib plugin.
Installation and configuration is very simple, just add “zlib” to the mail_plugins configuration.
If you want you can specify the level of compression too – but the default value is just fine.
mail_plugins = $mail_plugins zlib
Only new Mails get compressed upon arrival. Existing Mails stay as they are.
As soon as a new Mail arrives, it gets compressed and is stored in your mailbox. If you have a closer look on the actual mail file you see that it is not a ordinary text file but a compressed file.
[root@server cur]# file 1398234.M33854922198.mail.server.com,S=2420,W=2465:2,S 1398234.M33854922198.mail.server.com,S=2420,W=2465:2,S: gzip compressed data, from Unix
Additional information can be found in the Dovecot Wiki.