Brian Armstrong: > I am trying to set up postfix to send bounced messages to an external script > to log the bounce to an external logging service so that we can monitor > bounce rates to different recipient domains. I want to keep the default > bounce behavior intact, so bounce notices are still send to the original > sender. > > I have been hunting and testing different configurations for 2 days and > haven't had success, yet, in figuring it out.
Configure the appropriate bounce-recipient and use a transport map to pipe mail for that recipient into a script: /etc/postfix/main.cf notify_classes = bounce, .... bounce_notice_recipient = u...@example.com transport_maps = hash:/etc/postfix/transport /etc/postfix/transport: u...@example.com bounce-pipe: /etc/postfix/master.cf bounce-pipe .... pipe flags=xxx user=yyy argv=/path/to/script # postmap /etc/postfix/transport # postfix reload The bounce message contains the failed recipient (the Final-Recipient: field) and the envelope sender (the X-Postfix-Sender: field). An example of all this is at the end of ADDRESS_REWRITING_README. Wietse