This patch modifies qmail-smtpd to check for an environment variable, $RCPTCHECK. If it is set, for each 'rcpt to:' that qmail-smtpd receives, it will fork/exec $RCPTCHECK. $RCPTCHECK is run in the same environment as qmail-smtpd (Note that qmail-smtpd changes its CWD to qmail-home [typically /var/qmail] at startup). Additionally $SENDER is set to the envelope from (mail from:) and $RECIPIENT is set to the envelope recipient (for the current rcpt to:). Based on the return code (exit value) of $RCPTCHECK, the rcpt to: address will either be accepted or rejected as follows:
Useful for validating recipient to addresses with an arbitrary program (such as fastforward in '-n' mode).
This is how I use this patch.
Ryan Brown wrote a Perl script which you can use in combination with this patch if you're using qmail as a backup MX and you want to verify addresses with your primary MX.