Note to self: The Sendmail Installation and Operation Guide (at least version 1.25 of doc/op.ps) clearly states:
“The mailer with the special name “discard” causes any mail sent to it to be discarded but otherwise treated as though it were successfully delivered. This mailer cannot be used in ruleset 0, only in the various address checking rulesets.”
So, instead of writing something like this:
LOCAL_RULE_0 R$={NIL} < @ $=w . > $* $#discard $: $1
you need to write something like this:
LOCAL_RULE_0 R$={NIL} < @ $=w . > $* $#local $: bit-bucket
otherwise you get beaten by “buildaddr: unknown mailer discard” errors, even though $#discard is very well known (to you; not to ruleset 0).
The above example assumes that $={NIL} is a class that contains usernames for which we do not want to accept any email and bit-bucket is an entry in /etc/mail/aliases:
bit-bucket: /dev/null
Yes, it is possible to achieve the same thing using FEATURE(`virtusertable’), but you can use this hack as a guide when you have more complex situations, where you may need to decide programmagically on whether to discard the email or not.