To illustrate one use for this ${addr_type} macro's value, consider a rule set that screens addresses and rejects any that are found in a database of spam sender hosts: LOCAL_CONFIG Kspammers hash /etc/mail/spammers LOCAL_RULESETS SDomainLookup R $+ <@ $=w .> $@ OK local users are always OK R $+ <@ $+> $: $1 <@ $2 > <$&{addr_type}> R $+ <@ $+> <e r> $@ OK we only screen envelope senders. R $+ <@ $+> <h> $@ OK we don't screen header addresses. R $+ <@ $+> <$*> $(spammers $2 $: OK $) R OK $@ OK R $* $@ ERROR Under the LOCAL_CONFIG section of this mc configuration file, we define a database, /etc/mail/spammers, that contains a list of sites we want to reject for spamming. Under the LOCAL_RULESETS section, we declare the DomainLookup rule set. We might call this rule set from other policy rule sets, such as Local_check_mail (Section 7.1.2). The first rule accepts anything that looks like a local address. The second rule appends the value of the ${addr_type} macro to the workspace. The third and fourth rules accept all envelope recipient addresses and all header addresses, but not envelope sender addresses. The fifth rule looks up the envelope sender's host in the spammers database. If that hostname is found, its value is returned (a spam site was found). If it is not found in the database, OK is returned (the site is not a spam site). The last two rules simply return OK or ERROR to indicate the nature of the hostname. Depending on how you employ this rule set, you might wish to return more complex information, such as the original workspace augmented with good or bad. ${addr_type} is transient. If it is defined in the configuration file or command line, that definition can be ignored by sendmail. Note that it is currently not possible to differentiate between a header sender and a header recipient with this macro. Also note that a $& prefix is necessary when you reference this macro in rules (that is, use $&{addr_type}, not ${addr_type}). |