[comp.mail.sendmail] Catching bad addresses

msir@uhura.cc.rochester.edu (Mark Sirota) (12/29/88)

Several months ago (and several months before that, and ...) there was a
discussion on how to catch bad addresses and forward them to some other
machine which might be able to resolve them.

In other words, I want my configuration files to be able to do the
following:
(1) Try to resolve the host part of the address.
(2) If I can't, then forward the letter to cc.rochester.edu (which has a
	better chance of succeeding).

This may come up if, for instance, my local machines are not running name
service but cc.rochester.edu is.

I seem to recall that someone suggested putting a '.' at the end of the
hostname before canonicalizing it with $[ and $], but I can't seem to get
that to work.  Is there some way of accomplishing this?

Thanks in advance.  And I apologize for the multitudinous questions I've
posted to this forum in the last week or so...  I can only hope they seem
like intelligent ones.
-- 
Mark Sirota - University of Rochester, Rochester, NY
 Internet: msir@cc.rochester.edu
 Bitnet:   msir_ss@uordbv.bitnet
 UUCP:     ...!rochester!ur-cc!msir

bob@kahala.hig.hawaii.edu (Bob Cunningham) (01/04/89)

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                   <route-addr> canonical
Bob Cunningham
Hawaii Institute of Geophysics, University of Hawaii
bob@kahala.hig.hawaii.edu