Not all files should be packed to compressed format. JPEG, AVI or ZIP and RAR files already have reduced size, they're internally compressed. Second time compressing will not decrease size, in worst case will increase it.
Compress mail attachments larger than 5 MB
I recently need a solution where all incoming attachments should be taken from message, compressed and put back into the message. I don't want to compress outgoing traffic.
I will use MSH Traffic Policy application, it's very flexible and powerful software, it helps to solve many problems with MTA's traffic.
- Create new rule and name it Pack Incoming Attachments.
- On Actions tab click button Add and select Compress Attachments menu.
- Enter 5 MB in size section. Only attachments which are greater or equal 5 MB will be compressed.
- By default ZIP, TAR.GZ and BZ2 files are skipped. You can add another extensions you like. Ie. *.JPEG, *.AVI, and *.RAR.
- Click button OK.
|Compress attachments with Postifx, Sendmail and Zimbra|
To apply action only on incoming email messages, we need to exclude all messages which are not sent from our company domain.
- On Exceptions tab click button Add and select Message Sender menu.
- Enter your domain name using wild cards, like *@domain.com.
- Click button OK.
- Click button OK to close rule wizard.
- Click button Save All settings to apply changes.
|Message Sender exception to exclude outgoing traffic.|
When rule is active all email messages which are not sent from *@domain.com will have compressed attachments. This action give you a whole range of options to manipulate email attachments.
If you're looking for something else to do with attachments, like:
- detaching attachments,
- completely removing all type of attachments
- stripping them from email message and inserting info about it
- adding new attachment to e-mail
you should learn more about MSH Traffic Policy milter for Postifx, Sendmail and Zimbra.