# Mostly rfc1123 compliant sendmail.cf
#
# Mail sendmail-admins-request@itd.umich.edu to join
# sendmail-admins@itd.umich.edu. sendmail-admins carries information
# regarding this sendmail.cf, including announcements of changes
# and discussions of interest to admins.
#
DWtotalrecall
Dw$W.rs.itd.umich.edu

DBcunyvm.cuny.edu
DUdestroyer.rs.itd.umich.edu

DV2.2
De$j sendmail ($v/$V) ready at $b
Dj$w
DlFrom $g $d
Dnmailer-daemon
Do.:%@!^=/[]
Dq$?x\"$x\" <$g>$|$g$.

OA/etc/aliases
OQ/var/spool/mqueue
OH/usr/lib/sendmail.hf
OS/usr/lib/sendmail.st
OP
OD
OX10
Ox5
Ou1
Og1
Odb
OF0600
OL9
Oo
Or15m
Os
OT3d

H?P?Return-Path: <$g>
HReceived: $?sfrom $s $.by $j ($v/$V)
	$?rwith $r $.id $i; $b
H?D?Resent-Date: $a
H?F?Resent-From: $q
H?M?Resent-Message-Id: <$t.$i@$j>
H?M?Message-Id: <$t.$i@$j>
H?D?Date: $a
H?x?Full-Name: $x
H?F?From: $q

Troot uucp daemon

Pspecial-delivery=100
Pfirst-class=0
Pjunk=-100

# Organization:
#
#	ruleset 3 and friends
#		focus addresses, don't screw with them
#	ruleset 0 and friends
#		beat the hell out of addresses, convert them to
#		their deliverable form
#	mailers and associated rulesets
#		* focused addresses are body addresses, and should be
#		  left as they are
#		* unfocused addresses are envelope addresses, and should
#		  be converted to the mailers format
#	ruleset 4
#		remove focus on all addresses

# All addresses are passed through this rule. It functions by finding
# the host to delivery to, and marking it with <>
S3
R$*<$+>$*			   $2			remove comments
R$+:$*;				$@ $1:$2;		done if list
R$*@$+				$: $>5$1@$2		focus rfc822 addresses
R$+!$+				$: $>6$1!$2		focus uucp
R$*<@$+>$*			$: $1<@$[$2$]>$3	canonicalize
R$*<$+>$*			$@ $1<$2>$3		done if focused
R$+%$+				$: $1@$2		a%b -> a@b
R$+@$+%$+			   $1%$2@$3		a@b%c -> a%b@c
R$+@$+				$: $>3$1@$2		try again...

# Find the "next hop" in normal rfc822 syntax. These rules
# all return upon marking the next hop with <>
S5
R@$+,@$+:$+			$@ <@$1>,@$2:$3		@a,@b:@c -> <@a>,@b:c
R@$+:$+				$@ <@$1>:$2		@a:b -> <@a>:b
R$+@$+				$@ $1<@$2>		a@b -> a<@b>

# Focus bang style addresses. Won't change already focused addresses.
# Strips .uucp in bang paths, and converts domain syntax to rfc822 adresses.
S6
R$*<$+>$*			$@ $1<$2>$3		already focused
R$+!$+				$: <$1!>$2		a!b -> <a!>b
R<$+.uucp!>$+			   <$1!>$2		<a.uucp!>b -> <a!>b

# Find a mailer. This involves finding the "real" host to deliver to,
# by removing our local name, and/or doing a "domain forward"
S0
R$+				$: $>7$1		deliverable format
R$*<$+>$*			$: $>11$1<$2>$3		domain forward
R<$+!>$+			$: $>12<$1!>$2		route uucp
R$*<@$+.bitnet>$*		   $#inet$@$B$:$1<@$2.bitnet>$3
R$*<@umich.edu>$*		   $#mail500$@umich.edu$:<$1>
R$*<@itd.umich.edu>$*		   $#mail500$@itd.umich.edu$:<$1>
#R<$+!>$+			   $#uux$@$U$:<$1!>$2
R<$+!>$+			   $#unet$@$U$:<$1!>$2
R$*<@$+>$*			   $#inet$@$2$:$1<@$2>$3
R$+				   $#local$:$1

# Find the delivery address. Convert to standard-internal form,
# remove local name.
S7
R<$-.$+!>$+			   $3<@$1.$2>		<a.b!>c -> c<@a.b>
R$*<@$-.uucp>$*			   $>8$1@$2.uucp$3	*.uucp to !
R$*<$+>$*			$: $>9$1<$2>$3		strip local name

# Convert rfc822 syntax to a uucp "bang path". This works well
# on normal a@b address and route-addrs. It will also do something
# to list syntax address, but it's not clear how correct it is.
S8
R@$+,@$+:$+			   @$1!$2:$3		@a,@b:c -> @a!b:c
R@$+:$+@$+			   $1!$3!$2		@a:b@c -> a!c!b
R@$+:$+!$+			   $1!$2!$3		@a:b!c -> a!b!c
R$+@$+				   $2!$1		a@b -> b!c
R$+				$: $>3$1		refocus

# Remove local names. You won't see things like a.b!u or u@b.uucp.
# Add new rules here to accept more than just the default locally.
S9
R$*<@$w>$*			   $>10$1<@>$2		remove local name
R<$W!>$+			   $>10<!>$1
R<@umich.edu>$*:$*		   $>10<@>$1:$2
R$+%$+<@umich.edu>		   $>10$1%$2<@>
R$+!$+<@umich.edu>		   $>10$1!$2<@>

# Called only from above. Refocus and loop.
S10
R<@>,$+				   $>3$1
R<@>:$+				   $>3$1
R$+<@>				   $>3$1
R<!>$+				   $>3$1
R$*<$+>$*			$: $>7$1<$2>$3

# Convert domain names to uucp names, and refocus
S11
#R$*<@inquiry.org>$*			$: $>8$1@inquiry$2

# Route uucp addresses, if we're not connected to them. We rely on the
# domain-path operator to down case addresses.
S12
R<$+!>$+			$: <${$1$}!>$2		pathalias route
R<$+!$+!>$+			   <$1!>$2!$3		<a!b!>c -> <a!>b!c

Muux, P=/usr/bin/uux, F=DFMhu, S=13, R=14,
	A=uux - -gC -b -r -a$f $h!rmail ($u)
Munet, P=[IPC], F=mDFMhuX, S=13, R=14, A=IPC $h, E=\r\n
Minet, P=[IPC], F=mDFMuX, S=15, R=15, A=IPC $h, E=\r\n
Mlocal, P=/bin/mail, F=rlsDFMmn, S=16, R=16, A=mail -d $u
Mprog, P=/bin/sh, F=lsDFMe, S=16, R=16, A=sh -c $u
Mmail500, P=/usr/local/etc/mail500, F=DFMSmnXuh,
	A=mail500 -f $f -h $h -m $n@$w $u

# UUCP mailers require that the sender be in ! format.
# XXX Do we add our name to other people's paths?
S13
R$*<@$+>$*			$: $>8$1@$2$3
#R<$w!>$+			$@ <$W!>$1
R<$+!>$+			$@ <$1!>$2
R$+:$*;				$@ $1:$2;
R<>				$@
#R$+				$@ <$W!>$1
R$+				$@ <$w!>$1

# Only add our name to local mail. Anything that's focused, leave alone.
S14
R$*<$+>$*			$@ $1<$2>$3
R$+:$*;				$@ $1:$2;
#R$+				$@ <$W!>$1
R$+				$@ <$w!>$1

# SMTP mailers require that addresses be in rfc822 format. If there's no
# @ in the address, add one.
S15
R<$W!>$+			   $1<@$w>
R<$-.$+!>$+			   $3<@$1.$2>
R$*<@$+>$*			$@ $1<@$2>$3
R<$+!>$+			$@ $1!$2<@$w>
R$+:$*;				$@ $1:$2;
R<>				$@
R$+				$@ $1<@$w>

# Local and prog mailer
S16
R$+				$@ $1

#
# Called on all outgoing addresses. Used to remove the <> focus
#
S4
R$*<$+>$*			$@ $1$2$3		defocus
