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

I am trying to configure postfix so that ALL mail that arrives (to any domain) is piped into a shell script that I have.

I have tried several things, including setting

mailbox_command = path_to_my_script

and this works, but will only accept mail to actual local accounts.

I also tried to set

local_recipient_maps =

which I believe is supposed to accept all mail, but this does not seem to work.

I am running postfix 2.5.5-1.1 on Ubuntu Jaunty (9.04).

share|improve this question
up vote 4 down vote accepted

Take a look at There are a lot of services/examples defined there already, it will be a good starting point. Next define virtual_transport and set it to the name you defined in For example ( i am using dovecot's LDA at my setups ) :

In :

dovecot unix    -       n       n       -       -      pipe
  flags=DR user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension}

In :

virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

This should get you started :)

Or you can implement it as a check_policy_service filter daemon for the smtpd_recipient_restrictions. Reading the postfix docs is the best place to get you started :)

share|improve this answer
I sort of got started with petre's answer, but the clarification of the helped a bit :) – Francis Rath Sep 4 '09 at 19:45

define a service in and then in

virtual_transport = transport_name

or use it in /etc/transport if you don't have virtual addresses

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.