[comp.mail.misc] Automatic forwarding

michael@vuecho.psy.vu.nl (Michael Felt) (10/06/87)

First I aplologize about the length. (230+ lines)

Included are some key lines from the sendmail.cf used at our site.
We are in the fortunate position that a backbone (.nl 2 hops down the line)
is VERY SMART and bridges to everywhere. Thus, if the address isn't a local
domain I put it on the line.

Our biggest problem is getting the From line (with remote from) correct.
I don't bother with that here. This is long enough. Those interested
can e-mail me. I don't always have the time to read news.

Hope this helps.
====
from psy.vu.nl sendmail.cf
===

#	@(#)version.m4	4.7		8/31/83

############################################################
###	local info
############################################################

# domain		$D
DDpsy.vu.nl
CDpsy.vu.nl

# official hostname	$j
Dj$w.psy.vu.nl

# our downline host	$F	FORWARDING HOST
DFbotter

# UUCP name		$U
DUpsy.vu.nl

# sites we know
# class I : informatica
DIcs			$I	Informatica
CIvuinf inf vu44 cs botter

# class L : local hosts
DLpsy			$L	Local Hosts
CLecho vuecho vax wundt vupsy cannon pdp

# class P : pdp (cannon)$P	pdp aliases
DPcannon
CPvupsy cannon pdp

# class V : vax (wundt) $V	vax aliases
DVwundt
CVwundt vuecho vax wundt echo

--- many lines deleted

# forwarding host -- redefine this if you can't talk to the relay directly
DRbotter
DF$R

--- many lines deleted

###########################
###   Rewriting rules   ###
###########################

################################
#  Local Config Rewriting      # handle <route-addr>
################################
S6
# rules to strip unnessary domain from adresses
# we are focused on the domain between <>

R$*<@$=L>		$@$1<@$2.LOCAL>		# localize domain (incoming)
R$*<@$=I>		$@$1<@$I.LOCALVU>	# localize domain (incoming)
R$*<@$*.psy.vu.nl>	$@$1<@$2.LOCAL>		# localize domain (incoming)
R$*<@psy.vu.nl>		$@$1<@LOCAL>		# localize domain (incoming)

S8
# more host dependent cleanup
# strip the string botter!mcvax
R$=I!mcvax!$-		$@$2@cwi.nl	change to RFC 822 format
R$=I!mcvax!$*		$@$2		change to RFC 822 format

R$=I!$*			$@$2@cs.vu.nl	set proper domain

# strip local information if domain is LOCAL
R$=L!$*LOCAL$*		$@$2LOCAL$3

--- Rules S1 and S2 deleted

--- Rule S4 deleted

###########################
#  Name Canonicalization  #
###########################
S3

# handle "from:<>" special case
R<>			$@@				turn into magic token

# basic textual canonicalization
R$*<$+>$*		$2				basic RFC821/822 parsing

--- many lines deleted

R$+			$:$>8$1				host dependent cleanup

# the next three handle and return if a domain is present

R$+@$+			$:$1<@$2>			focus on domain
R$+<$+@$+>		$1$2<@$3>		recursive move gaze right
R$+<@$+>		$@$>6$1<@$2>			already canonical

# should only pass this far if no @ is in the address

# convert first argument of UUCP! (bang) address into domain
# and pass to rule six
# NOTICE similiarity to previous rule !!!
R$+!$+			$@$>6$2<@$1>			resolve uucp names


############################################################
############################################################
#####
#####		RULESET ZERO PREAMBLE
#####
#####	The beginning of ruleset zero is constant through all
#####	configurations.
#####
#####		@(#)zerobase.m4	4.1		7/25/83
#####
############################################################
############################################################

S0

--- many lines deleted
--- end of preamble

# resolve names we can handle locally
R<@$+.UUCP>:$+		$1!$2			to old format
R$+<@$+.UUCP>		$1@$2.UUCP
# defocus first (once)
R$*<$*>$*		$:$1$2$3			defocus
R$=w!$+			$2				thishost!foo

# in principle no further processing of the address is done.
# That is, either it has no domain (is local) OR
#	it has a local domain (is local or uucp)
#	it has a bad local domain (foo.psy.vu.nl) - MAILER-DAEMON gets it
#	it has an unknown domain foo@foo	(forward it)

# check for pdp aliases
R$+@$=P			$#uucp$@$P$:$1		user@pdp
R$+@$=P.UUCP		$#uucp$@$P$:$1		user@pdp
R$+@$=P.LOCAL		$#uucp$@$P$:$1		user@pdp

# check for vax aliases
R$-@$=V			$1			local names
R$-@$=V$*LOCAL		$1			local names
R$-@psy.vu.nl		$1			local names
R$-			$#local$:$1			local names

# names that pretend to be LOCAL aren't resolved, break them

R$*LOCAL		$@@			can't resolve
R$*psy.vu.nl		$@@			can't resolve

# doesn't seem to be local - forward it to cs.vu.nl
R$+			$#uucp$@$F$:$1			forward mail

############################################################
############################################################
#####
#####		Local and Program Mailer specification
#####
#####		@(#)localm.m4	4.1		7/25/83
#####
############################################################
############################################################

Mlocal,	P=/bin/mail, F=rlsDFMmn, S=10, R=20, A=mail -d $u
Mprog,	P=/bin/sh,   F=lsDFMe,   S=10, R=20, A=sh -c $u

S10
R@			MAILER-DAEMON			errors to mailer-daemon

#	don't start uucico immediately
#Muucp,	P=/usr/bin/uux, F=sDFMhuU, S=15, R=25, M=100000,
#	A=uux - -r $h!rmail ($u)

#	start uucico immediately
Muucp,	P=/usr/bin/uux, F=sDFMhuU, S=15, R=25, M=100000,
	A=uux - $h!rmail ($u)

S15
R$-			$:$1@psy.vu.nl		stick on our domain

# the next three should be only in rule 4, but I don't trust sendmail
R$*LOCAL$*		$1psy.vu.nl$2
R$*LOCALVU$*		$1.vu.nl$2
R$*LOCALNL$*		$1.nl$2

R$*@$=L.psy.vu.nl	$@$2.$D!$1		UUCP name for remote
R$*@$=L			$@$2.$D!$1		UUCP name for remote
R$+			$:$D!$1

# make sure it isn't ridiculous

R$*@psy.vu.nl		$1			strip @thisdomain
R$*psy.vu.nl!$=V.psy.vu.nl!$*		$@$1$D!$3

S25
R$-			$@$1@psy.vu.nl		stick on our domain
R$*LOCAL$*		$1psy.vu.nl$2
R$*LOCALVU$*		$1vu.nl$2
R$*LOCALNL$*		$1nl$2
R$*<@$+>$*		$@$1<@$2>$3		accept usual domain name
======
Michael Felt
michael@psy.vu.nl
michael@vupsy.UUCP
...!mcvax!vupsy!michael