Postfix email Gateway - Outgoing mail checks

CraigFishman used Ask the Experts™
My Postfix installation is currently just an email gateway and doing greylisting to drop most of the spam before it reaches our Exchange server, and relaying outgoing mail from the Exchange server.  

One thing I'd really like to be able to do, is set up filters on outgoing email from the Exchange server.  For example, let's say we have a secret project called "SecretProject", and we don't want anyone emailing someone on the outside world about it.  I'd like to be able to set up a filter for outgoing mail that would scan all the messages for "SecretProject" with a regular expression, or even just a keyword.  
Then, when a match is found, have Postfix silently refuse to deliver the email, and also drop a copy of it into a folder for examination.  I'm not looking to have it scan attachments, as that'd probably be really difficult, but just a body check should be sufficient.  How could I go about doing this?  
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
System Architect
I think trnasport maps would do the trick although I am not sure, also there is procmail its an 3rd party app that can be integrated with postfix (or other SMTPs) that allows you to do some scripting on inbound and outbind mail.


Wasn't a complete answer, but definitely pointed me in the right direction.  Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial