Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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'm trying to archive incoming mail by routing it to a PHP script (which inserts it into a database) before sending the email to the destination server.

If I configure my /etc/postfix/transport as such: smtp:[]

My email will then be forwarded to the Exchange server ( for testing) to the appropriate mailbox.

If I configure my /etc/postfix/transport as such: myarchive:

Then incoming email is piped to a PHP script and inserted into a database, however it never makes it to Exchange.

I've tried adding multiple transports myarchive: smtp:[]

But it only makes it to the first one listed (I've tried both ways). Can something like this be achieved to archive a mail before sending it on its merry way?

Note: "myarchive" is set up in /etc/postifx/ as:

myarchiver unix - n n - - pipe

flags=FR user=mailarchive argv=/home/mailarchive/pipe.php

${nexthop} ${user}

share|improve this question

Postfix cannot deliver a message to multiple destinations. You can however use the always_bcc directive to automatically BCC all messages to another address. You still need to configure the transports to deliver messages to the special archive address to your script.

always_bcc =
share|improve this answer
I had that working, but didn't like the BCC'ing part. Thanks though. – Ryan Jul 27 '12 at 18:30

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.