some time ago I saw a question about detecting bounced messages:
I am working on a tool that will be sending bulk messages (not spam :) and I need to add a feature t
The pertinent standard is called VERP, by the way.
You mean bounce+token@yourdomain.com
, not just plain bounce@yourdomain.com
. The token is what makes it unique!
Postfix will already accept mail for a+something@example.net
given a valid address a@example.net
as long as you configure the recipient_delimiter
in main.cf
:
recipient_delimiter = +
There are a few different ways to configure Postfix so that it will deliver the mail to your script AND tell you what the token was. Try this:
Create the address bounce@yourdomain.com
the same way you create aliases normally in that domain: e.g. a regular alias or a virtual mailbox
Create a custom delivery transport in master.cf
. ${extension}
means that the script will receive whatever came after the +
as its first argument, and <username>
should the the local uid under which the script should run.
bounce unix - n n - - pipe
flags=R user=<username> argv=/script/which/receives/bounces ${extension}
Create a transport map if you don't already have one:
transport_maps = hash:/etc/postfix/transport
Add the following line in /etc/postfix/transport
to direct bounce@yourdomain.com
to the new transport you created in master.cf
:
bounce@yourdomain.com bounce:
Rebuild the transport map:
postmap /etc/postfix/transport