1. Using environment variable BOUNCEPROCESSOR
When you define the environment variable BOUNCEPROCESSOR as a valid path to a program or script, the program gets called whenever a delivery fails permanently. The program runs with the uid qmails and is passed the following five arguments
bounce_file bounce_report bounce_sender original_recipient bounce_recipient
To set BOUNCEPROCESSOR, you would do the following
# echo "path_of_your_bounce_processor" > /service/qmail-send.25/variables/BOUNCEPROCESSOR
There are few email marketing companies who are using BOUNCEPROCESSOR to insert the status of all bounces in MySQL table for their email marketing campaigns.
2 Using environment variable BOUNCERULES or control files bounce.envrules.
Using envrules, you can set specific environment variables only for bounced recipients. The format of this file is of the form
where pat is a regular expression which matches a bounce recipient. envar1, envar2 are list of environment variables to be set. If var is omitted, the environment variable is unset.
causes all bounces generated for the sender email@example.com to be discarded.
3. Using BOUNCEQUEUE environment variable to queue bounces
qmail-send uses qmail-queue to queue bounces and aliases/forwards. This can be changed by using QMAILQUEUE environment variable. If a different queue program is desired for bounces, it can be set by using BOUNCEQUEUE environment variable.