Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!pasteur!helios.ee.lbl.gov!nosc!humu!uhccux!kahala!bob From: bob@kahala.hig.hawaii.edu (Bob Cunningham) Newsgroups: comp.mail.sendmail Subject: Re: Catching bad addresses Message-ID: <2926@uhccux.uhcc.hawaii.edu> Date: 3 Jan 89 21:24:16 GMT References: <576@ur-cc.UUCP> Sender: news@uhccux.uhcc.hawaii.edu Reply-To: bob@kahala.hig.hawaii.edu (Bob Cunningham) Organization: University of Hawaii, Honolulu Lines: 69 There are many ways to do this; an approach which works well in many situations is to pre-validate all known local host names, and deliver to them, then throw everything else over to a reasonably-smart relay machine. Because I find this sort of thing reasonably handy, I'm enclossing a fragment of a sendmail.cf which delivers mail ONLY to known local hosts (and internet numeric addresses); everything else gets tossed to a relay machine. Suppose: macro w stands for your (unqualified) local host name macro D stands for your domain (i.e., Dj$w.$D is your host's fully-qualifed name class L stands for all your known (unqualified) local host names, either from a file or listed explicitly in your sendmail.cf macro R stands for the (fully-qualified) name of your relay machine Then your ruleset zero can look something like (omitting any uucp stuff): S0 R@ $#local $:$n handle <> form R$- $#local $:$1 obvious local name # Recognize ourselves. R$*<@w>$* $@$>6$1 this host R$*<@w.$D>$* $@$>6$1 this host # Pre-emptive delivery to specified local sites only R$*<@$=L>$* $#ether $@$2.$D $:$1<@$2.$D>$3 local site R$*<@$=L.$D>$* $#ether $@$2.$D $:$1<@$2.$D>$3 local site # Internet number specification for RFC822 compatibility. R<@[$+]>:$* $:$>9 <@[$1]>:$2 Clean it up, then... R<@[$+]>:$* $#ether $@[$1] $:$2 numeric internet spec R<@[$+]>,$* $#ether $@[$1] $:$2 numeric internet spec R$*<@[$+]> $#ether $@[$2] $:$1 numeric internet spec # Miscellanous cleanup R<@>:$* $@$>6$1 retry after route strip R$*<@> $@$>6$1 strip null trash & retry # General Internet mail. R$*<@$*.$+>$* $#ether $@$R $:$1<@$2.$3>$4 name.domain # Other possibilities. R$+ $: $>9 $1 clean up external forms # By default, EVERYTHING else goes to the relay. R$+ $#ether $@$R $:$1 ### Ruleset 6 just calls rulesets 3 then 0, used in ruleset 0. S6 R$* $: $>3 $1 First canonicalize R$* $@ $>0 $1 Then rerun ruleset 0 # Cleans up address for mailer by externalizing internal forms which # don't meet external specs...but leave focused S9 R@ $@$n handle <> error addr R<@$+>$*:$+:$+ <@$1>$2,$3:$4 canonical Bob Cunningham Hawaii Institute of Geophysics, University of Hawaii bob@kahala.hig.hawaii.edu