Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to check outgoing mails with rules like :

  • mails sent to a particular domain
  • mails sent without subject or with a specific subject
  • mails with an attachment of a certain size
  • mails sent to x recipients

What I want to do when a mail is recognised by one of these rules could be to send it to a special address, to save it with smtp-sink or return a special message.

Is this possible to do this check and apply an action within postfix or a couple of scripts called by postfix ?

share|improve this question
up vote 2 down vote accepted

You could combine your Postfix setup with some other mail server dealing with the logic, like Lamson, a mail handling framework written/configurable in Python. See its documentation on the FSM logic, and the getting started.

share|improve this answer
That's a good idea. Thanks – Coren Apr 27 '12 at 16:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.