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
pat:envar1=val,envar2=val,...]
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.
e.g.
support@indimail.org:CONTROLDIR=control2,QMAILQUEUE=/var/indimail/bin/qmail-nullqueue
causes all bounces generated for the sender support@indimail.org 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.
e.g
# echo /var/indimail/bin/qmail-nullqueue > /service/qmail-send.25/variables/BOUNCEQUEUE
disables bounces system-wide. Though disabling bounces may not be the right thing to do but in some situations where bounces are not at all needed, disabling bounces will surely result in performance improvements of your system, especially so if your system does mass-mailing.