On 3/15/2010 8:59 AM, Fitzgerald wrote:
Hi there!

Currently I am looking for a way to implement a bounce handler and I would
like some 'best practices' advice. I have very little experience in using
postfix but I came up with some ideas and want to get some comments on
those.

An application sends out a bunch of e-mails with a varying return path
(VERP) of the form bounce-some_identif...@mydomain.tld where
some_identifier is a unique and random string. My idea is to have a python
bouncehandler script that will parse all bounces and notify the application
that certain e-mails did not arrive at their destination.

To complete the puzzle I need the following:
1. Postfix needs to accept mail of the form
bounce-some_identif...@mydomain.tld

Use main.cf
recipient_delimiter = -
to accept all mail to bounc...@example.com
http://www.postfix.org/postconf.5.html#recipient_delimiter

It's more common to use "+" as both recipient_delimiter and the VERP separator, but use whichever works better for you. Either should be OK as long as you use the same separator in both places.

2. Postfix needs to deliver this mail to a unix socket where the python
bouncehandler is listening

Define a pipe transport in master.cf that delivers to your python application. See several examples in master.cf and also
http://www.postfix.org/pipe.8.html

Then use a transport_maps entry to direct the bounce mail to that transport (assuming a master.cf transport named pybounce). Something like
# main.cf:
transport_maps = hash:/etc/postfix/transport

# /etc/postfix/transport
bou...@example.com  pybounce:
http://www.postfix.org/transport.5.html

3. The delivery of 2 is handled according to a certain protocol or
specification

The full text of the bounce will be delivered to the script, with the envelope recipient as an argument.

  -- Noel Jones

Reply via email to