Aaron Clausen:
> We are running a couple of Postfix servers as SMTP gateways for our
> Exchange 2010 servers. In other words, Postfix is running purely as a
> relay host.
> 
> What we need to do is to capture emails sent to specific email
> addresses, grab a copy for processing via Perl or PHP scripts, while
> passing on the email itself to the Exchange server.
> 
> I am a little unclear on the details of how to do that, and would
> appreciate some guidance.

Untested example:

/etc/postfix/main.cf:
    recipient_bcc_maps = hash:/etc/postfix/rcpt_bcc
    transport_maps = hash:/etc/postfix/transport
    # Don't forget the destination recipient limit.
    copy_pipe_destination_recipient_limit = 1

/etc/postfix/rcpt_bcc:
    us...@example.com   copy-us...@example.com
    us...@example.com   copy-us...@example.com

Note: postfix will not return a bounce message when mail to
a recipient_bcc_maps address fails.

Note: maybe it is OK if the copies all have the same address.

/etc/postfix/transport:
    copy-us...@example.com      copy_pipe:
    copy-us...@example.com      copy_pipe:

/etc/postfix/master.cf:
    copy_pipe   unix  -       n       n       -       -       pipe
        flags=DRX user=somebody directory=somewhere
        argv=/path/to/command arguments...

Run "postmap /etc/postfix/transport", "postmap /etc/postfix/rcpt_bcc"
whenever the table is changed.

http://www.postfix.org/pipe.8.html
http://www.postfix.org/transport.5.html
http://www.postfix.org/master.5.html
http://www.postfix.org/postconf.5.html#recipient_bcc_maps

        Wietse

Reply via email to