
As I understand it (possibly wrong), the way this
if ($DEBUG) { $to = join(',', @to); print STDERR "to: $to\n"; print STDERR "sender: $sender\n"; print STDERR "server: $server\n"; exit(-1); }
works is it exits with an error, so sendmail returns an undeliverable status/notice containing the script output.
Obviously, your logging is much nicer.
Correct. But as previously noted, syslog might not log anything at all on some systems -- that's why mm-handler didn't use it originally. And this is debugging code, not meant for live environments....
I have another question since I don't know sendmail. Does sendmail execute mm-handler at incoming SMTP time, and if so, does an error exit from mm-handler result in an SMTP failure status being returned to the sending MTA?
Yes. It's a local delivery agent mapped to your mailing lists' virtual domain, and it's the final step in an SMTP transaction. In a production environment it should exit with one of the statuses from <sysexits.h>. That will trigger an SMTP failure to the sending MTA with a message appropriate to that exit status.
If so, it seems that rather than just dropping a 'bad' message as mm-handler seems to do when $BounceUnapproved = 0; and $BounceNonlist = 0;, wouldn't it be better to exit with a failure status.
FWIW, I agree.
-- -D. dgc@uchicago.edu NSIT University of Chicago