Automatically compress large attachments

To make life easier and safe a lot hard drive space you could automatically compress incoming, internal or even outgoing attachments. Users don’t care if they sent big excel sheet documents, powerpoint presentations or any other files which easily could be zip’ed.

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.

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.

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 *
  • Click button OK.
  • Click button OK to close rule wizard.
  • Click button Save All settings to apply changes.

When rule is active all email messages which are not sent from * 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

To learn more visit MSH Traffic Policy website.

Łukasz is a software developer and owner of MSH Software company which builds email processing tools for Microsoft Exchange, Zimbra Collaboration Suite and Postfix. He specializes in server, desktop and web applications written in Java, .NET and C++.