Home

$#discard and ruleset 0

2008/02/25

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: