Server Fault is a question and answer site for system and network administrators. 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

Using Postfix I want to pipe all messages sent by an authenticated connection to an external script and still deliver it to the recipient. Is this possible and if so how?

share|improve this question
Thank you all for your coments. I can pipe all messages to a script defining a new transport in "". My problem is that I want to deliver the mail to the recipient at the same time. It should be possible but I can't figure out how to do it. – user119876 May 8 '12 at 8:15

I would try to do that by installing MIMEDefang and extending mimedefang-filter.

share|improve this answer

You are probably after a Sendmail milter (mail filter), which is a program that Postfix will pass all incoming mail to for filtering. You can write these in C, Python or Perl with the various libraries available.

If you don't want to write your own, you can try hooking in using milter-cli's content-filter option - this allows you to pipe all mail to an external script. Make sure your script always returns 0 to force delivery.

share|improve this answer

If you know the sender/recipient or can accept having all mail copied you can try the always_bcc1, recipient_bcc_maps2 and sender_bcc_maps3 options. Then have procmail or similar for the destination mailbox feed your script.

share|improve this answer

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.