xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 63858)
151222Sericdivert(-1)
251222Seric#
351222Seric# Copyright (c) 1983 Eric P. Allman
463592Sbostic# Copyright (c) 1988, 1993
563592Sbostic#	The Regents of the University of California.  All rights reserved.
651222Seric#
751222Seric# %sccs.include.redist.sh%
851222Seric#
951222Sericdivert(0)
1051222Seric
11*63858SericVERSIONID(`@(#)proto.m4	8.3 (Berkeley) 07/18/93')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1560894Sericifdef(`_OLD_SENDMAIL_',
1660894Seric`define(`_SET_96_', 6)dnl
17*63858Sericdefine(`_SET_97_', 7)dnl
18*63858Sericdefine(`_SET_98_', 8)dnl',
1958119Seric`# level 4 config file format
2060894SericV4
2160894Sericdefine(`_SET_96_', 96)dnl
22*63858Sericdefine(`_SET_97_', 97)dnl
23*63858Sericdefine(`_SET_98_', 98)dnl')
2452646Seric
2551222Seric##################
2651222Seric#   local info   #
2751222Seric##################
2851222Seric
2960212SericCP.
3060212Seric
3151889SericCwlocalhost
3251887Sericifdef(`USE_CW_FILE',
3351889Seric`# file containing names of hosts for which we receive email
3458406SericCONCAT(`Fw', confCW_FILE)', `dnl')
3551222Seric
3651222Sericifdef(`UUCP_RELAY',
3751222Seric`# UUCP relay host
3851281SericCONCAT(DY, UUCP_RELAY)
3960212SericCPUUCP
4057944Seric
4151222Seric')dnl
4251222Sericifdef(`BITNET_RELAY',
4351222Seric`#  BITNET relay host
4451222SericCONCAT(DB, BITNET_RELAY)
4560212SericCPBITNET
4657944Seric
4751222Seric')dnl
4851222Sericifdef(`CSNET_RELAY',
4951222Seric`# CSNET relay host
5051222SericCONCAT(DC, CSNET_RELAY)
5160212SericCPCSNET
5257944Seric
5351222Seric')dnl
5458364Sericifdef(`FAX_RELAY',
5558364Seric`# FAX relay host
5658364SericCONCAT(DF, FAX_RELAY)
5760212SericCPFAX
5858364Seric
5958364Seric')dnl
6058070Sericifdef(`SMART_HOST',
6158070Seric`# "Smart" UUCP relay host
6258070SericCONCAT(DS, SMART_HOST)
6351222Seric
6458070Seric')dnl
6558781Sericifdef(`MAILER_TABLE',
6658781Seric`# Mailer table (overriding domains)
6758781SericKmailertable MAILER_TABLE
6858781Seric
6958781Seric')dnl
7063754Sericifdef(`DOMAIN_TABLE',
7163754Seric`# Domain table (adding domains)
7263754SericKdomaintable DOMAIN_TABLE
7363754Seric
7463754Seric')dnl
7551222Seric# who I send unqualified names to (null means deliver locally)
7651222SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
7751222Seric
7857527Seric# who gets all local email traffic ($R has precedence for unqualified names)
7957527SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB))
8057527Seric
8158070Seric# my official hostname ($w or $w.$D)
8258070SericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D))
8358070Seric
8458070Seric# who I masquerade as (can be $j)
8558070SericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j))
8658070Seric
8757245Seric# class L: names that should be delivered locally, even if we have a relay
8857245Seric# class E: names that should be exposed as from this host, even if we masquerade
8951279SericCLroot
9057245SericCEroot
9151279Sericundivert(5)dnl
9251279Seric
9351222Seric# operators that cannot be in local usernames (i.e., network indicators)
9458288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
9551222Seric
9651322Seric# a class with just dot (for identifying canonical names)
9751322SericC..
9851322Seric
9958808Sericifdef(`_OLD_SENDMAIL_', `dnl',
10058808Seric`# dequoting map
10158808SericKdequote dequote')
10257944Seric
10359033Sericundivert(6)dnl
10459033Seric
10557944Seric######################
10657944Seric#   Special macros   #
10757944Seric######################
10857944Seric
10957944Seric# SMTP initial login message
11057944SericCONCAT(De, confSMTP_LOGIN_MSG)
11157944Seric
11257944Seric# UNIX initial From header format
11357944SericCONCAT(Dl, confFROM_LINE)
11457944Seric
11557944Seric# my name for error messages
11657944SericCONCAT(Dn, confMAILER_NAME)
11757944Seric
11857944Seric# delimiter (operator) characters
11957944SericCONCAT(Do, confOPERATORS)
12057944Seric
12157944Seric# format of a total name
12257944SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER,
12357944Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
12457944Sericinclude(`../m4/version.m4')
12557944Seric
12657944Seric###############
12757944Seric#   Options   #
12857944Seric###############
12957944Seric
13059887Seric# strip message body to 7 bits on input?
13159887SericCONCAT(O7, confSEVEN_BIT_INPUT)
13257944Seric
13357944Seric# wait (in minutes) for alias file rebuild
13457944SericCONCAT(Oa, confALIAS_WAIT)
13557944Seric
13657944Seric# location of alias file
13757944SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases))
13857944Seric
13958084Seric# minimum number of free blocks on filesystem
14058084SericCONCAT(Ob, confMIN_FREE_BLOCKS)
14158084Seric
14257944Seric# substitution for space (blank) characters
14357944SericCONCAT(OB, confBLANK_SUB)
14457944Seric
14557944Seric# connect to "expensive" mailers on initial submission?
14657944SericCONCAT(Oc, confCON_EXPENSIVE)
14757944Seric
14857944Seric# checkpoint queue runs after every N successful deliveries
14957944SericCONCAT(OC, confCHECKPOINT_INTERVAL)
15057944Seric
15157944Seric# default delivery mode
15257944SericCONCAT(Od, confDELIVERY_MODE)
15357944Seric
15457944Seric# automatically rebuild the alias database?
15557944SericCONCAT(OD, confAUTO_REBUILD)
15657944Seric
15757944Seric# error message header/file */
15857944Sericifdef(`confERROR_MESSAGE',
15963583Seric	CONCAT(OE, confERROR_MESSAGE),
16057944Seric	#OE/etc/sendmail.oE)
16157944Seric
16257944Seric# error mode
16357944Sericifdef(`confERROR_MODE',
16463583Seric	CONCAT(Oe, confERROR_MODE),
16557944Seric	#Oep)
16657944Seric
16757944Seric# save Unix-style "From_" lines at top of header?
16857944SericCONCAT(Of, confSAVE_FROM_LINES)
16957944Seric
17057944Seric# temporary file mode
17157944SericCONCAT(OF, confTEMP_FILE_MODE)
17257944Seric
17357944Seric# match recipients against GECOS field?
17457944SericCONCAT(OG, confMATCH_GECOS)
17557944Seric
17657944Seric# default GID
17757944SericCONCAT(Og, confDEF_GROUP_ID)
17857944Seric
17957944Seric# maximum hop count
18057944SericCONCAT(Oh, confMAX_HOP)
18157944Seric
18257944Seric# location of help file
18357944SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf))
18457944Seric
18557944Seric# ignore dots as terminators in incoming messages?
18657944SericCONCAT(Oi, confIGNORE_DOTS)
18757944Seric
18857944Seric# Insist that the BIND name server be running to resolve names
18957944Sericifdef(`confBIND_OPTS',
19057944Seric	CONCAT(OI, confBIND_OPTS),
19157944Seric	#OI)
19257944Seric
19359887Seric# deliver MIME-encapsulated error messages?
19459887SericCONCAT(Oj, confMIME_FORMAT_ERRORS)
19559887Seric
19657944Seric# Forward file search path
19757944Sericifdef(`confFORWARD_PATH',
19857944Seric	CONCAT(OJ, confFORWARD_PATH),
19957944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
20057944Seric
20157944Seric# open connection cache size
20257944SericCONCAT(Ok, confMCI_CACHE_SIZE)
20357944Seric
20457944Seric# open connection cache timeout
20557944SericCONCAT(OK, confMCI_CACHE_TIMEOUT)
20657944Seric
20761106Seric# use Errors-To: header?
20861106SericCONCAT(Ol, confUSE_ERRORS_TO)
20961106Seric
21057944Seric# log level
21157944SericCONCAT(OL, confLOG_LEVEL)
21257944Seric
21357944Seric# send to me too, even in an alias expansion?
21457944SericCONCAT(Om, confME_TOO)
21557944Seric
21657944Seric# verify RHS in newaliases?
21757944SericCONCAT(On, confCHECK_ALIASES)
21857944Seric
21957944Seric# default messages to old style headers if no special punctuation?
22057944SericCONCAT(Oo, confOLD_STYLE_HEADERS)
22157944Seric
22258860Seric# SMTP daemon options
22358860Sericifdef(`confDAEMON_OPTIONS',
22458860Seric	CONCAT(OO, confDAEMON_OPTIONS),
22558860Seric	#OOPort=esmtp)
22658860Seric
22758084Seric# privacy flags
22858084SericCONCAT(Op, confPRIVACY_FLAGS)
22958084Seric
23057944Seric# who (if anyone) should get extra copies of error messages
23157944Sericifdef(`confCOPY_ERRORS_TO',
23257944Seric	CONCAT(OP, confCOPY_ERRORS_TO),
23357944Seric	#OPPostmaster)
23457944Seric
23557944Seric# slope of queue-only function
23657944Sericifdef(`confQUEUE_FACTOR',
23757944Seric	CONCAT(Oq, confQUEUE_FACTOR),
23857944Seric	#Oq600000)
23957944Seric
24057944Seric# queue directory
24157944SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue))
24257944Seric
24357944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
24458119Sericifdef(`confREAD_TIMEOUT',
24558119Seric	CONCAT(Or, confREAD_TIMEOUT),
24658119Seric	#Ordatablock=10m)
24757944Seric
24857944Seric# queue up everything before forking?
24957944SericCONCAT(Os, confSAFE_QUEUE)
25057944Seric
25157944Seric# status file
25257944SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st))
25357944Seric
25457944Seric# default message timeout interval
25557944SericCONCAT(OT, confMESSAGE_TIMEOUT)
25657944Seric
25757944Seric# time zone handling:
25857944Seric#  if undefined, use system default
25957944Seric#  if defined but null, use TZ envariable passed in
26057944Seric#  if defined and non-null, use that info
26157944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
26257944Seric	confTIME_ZONE, `USE_TZ', `',
26357944Seric	`CONCAT(Ot, confTIME_ZONE)')
26457944Seric
26557944Seric# default UID
26657944SericCONCAT(Ou, confDEF_USER_ID)
26757944Seric
26851887Seric# list of locations of user database file (null means no lookup)
26958720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
27051222Seric
27158860Seric# fallback MX host
27258860Sericifdef(`confFALLBACK_MX',
27358860Seric	CONCAT(OV, confFALLBACK_MX),
27458860Seric	#OVfall.back.host.net)
27558860Seric
276*63858Seric# if we are the best MX host for a site, try it directly instead of config err
277*63858SericCONCAT(Ow, confTRY_NULL_MX_LIST)
278*63858Seric
27957944Seric# load average at which we just queue messages
28057944SericCONCAT(Ox, confQUEUE_LA)
28157944Seric
28257944Seric# load average at which we refuse connections
28357944SericCONCAT(OX, confREFUSE_LA)
28457944Seric
28557944Seric# work recipient factor
28657944Sericifdef(`confWORK_RECIPIENT_FACTOR',
28757944Seric	CONCAT(Oy, confWORK_RECIPIENT_FACTOR),
28857944Seric	#Oy30000)
28957944Seric
29057944Seric# deliver each queued job in a separate process?
29157944SericCONCAT(OY, confSEPARATE_PROC)
29257944Seric
29357944Seric# work class factor
29457944Sericifdef(`confWORK_CLASS_FACTOR',
29557944Seric	CONCAT(Oz, confWORK_CLASS_FACTOR),
29657944Seric	#Oz1800)
29757944Seric
29857944Seric# work time factor
29957944Sericifdef(`confWORK_TIME_FACTOR',
30057944Seric	CONCAT(OZ, confWORK_TIME_FACTOR),
30157944Seric	#OZ90000)
30257944Seric
30357944Seric###########################
30457944Seric#   Message precedences   #
30557944Seric###########################
30657944Seric
30757944SericPfirst-class=0
30857944SericPspecial-delivery=100
30958070SericPlist=-30
31057944SericPbulk=-60
31157944SericPjunk=-100
31257944Seric
31357944Seric#####################
31457944Seric#   Trusted users   #
31557944Seric#####################
31657944Seric
31757944SericTroot
31857944SericTdaemon
31957944SericTuucp
32057944Seric
32157944Seric#########################
32257944Seric#   Format of headers   #
32357944Seric#########################
32457944Seric
32558679SericH?P?Return-Path: $g
32660894SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b
32757944SericH?D?Resent-Date: $a
32857944SericH?D?Date: $a
32957944SericH?F?Resent-From: $q
33057944SericH?F?From: $q
33157944SericH?x?Full-Name: $x
33257944SericHSubject:
33357944Seric# HPosted-Date: $a
33457944Seric# H?l?Received-Date: $b
33557944SericH?M?Resent-Message-Id: <$t.$i@$j>
33657944SericH?M?Message-Id: <$t.$i@$j>
33751222Seric#
33851222Seric######################################################################
33951222Seric######################################################################
34051222Seric#####
34151222Seric#####			REWRITING RULES
34251222Seric#####
34351222Seric######################################################################
34451222Seric######################################################################
34551222Seric
34658678Sericundivert(9)dnl
34751222Seric
34851222Seric###########################################
34951222Seric###  Rulset 3 -- Name Canonicalization  ###
35051222Seric###########################################
35151260SericS3
35251222Seric
35358499Seric# handle null input and list syntax (translate to <@> special case)
35458499SericR$@			$@ <@>
35558707SericR$*:;$*			$@ $1 :; <@>
35658174Seric
35751222Seric# basic textual canonicalization -- note RFC733 heuristic here
35857012SericR$*<$*>$*<$*>$*		<$2>$3$4$5			strip multiple <> <>
35958158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
36058499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
36151222SericR$*<$+>$*		$2				basic RFC821/822 parsing
36251222Seric
36351222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
36455416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
36551222Seric
36651222Seric# localize and dispose of route-based addresses
36760894SericR@ $+ : $+		$@ $>_SET_96_ < @$1 > : $2		handle <route-addr>
36851222Seric
36951222Seric# find focus for list syntax
37060894SericR $+ : $* ; @ $+	$@ $>_SET_96_ $1 : $2 ; < @ $3 >	list syntax
37155416SericR $+ : $* ;		$@ $1 : $2;			list syntax
37251222Seric
37351222Seric# find focus for @ syntax addresses
37455416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
37555416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
37660894SericR$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
37751222Seric
37858288Sericifdef(`_NO_UUCP_', `dnl',
37958288Seric`# convert old-style addresses to a domain-based address
38060894SericR$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
38160894SericR$+ . $- ! $+		$@ $>_SET_96_ $3 < @ $1 . $2 >		domain uucps
38260894SericR$+ ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	uucp subdomains')
38351222Seric
38451222Seric# if we have % signs, take the rightmost one
38555416SericR$* % $*		$1 @ $2				First make them all @s.
38655416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
38760894SericR$* @ $*		$@ $>_SET_96_ $1 < @ $2 >		Insert < > and finish
38851222Seric
38951222Seric# else we must be a local name
39051222Seric
39151222Seric
39260894Seric################################################
39360894Seric###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
39460894Seric################################################
39551222Seric
39657245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
39760894SericS`'_SET_96_
39851222Seric
39951222Seric# handle special cases for local names
40060262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
40160262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
40260262Sericifdef(`_NO_UUCP_', `dnl',
40360262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
40463754Sericifdef(`DOMAIN_TABLE', `
40563754Seric# look up unqualified domains in the domain table
40663754SericR$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
40763754Seric`dnl')
40851889Sericundivert(2)dnl
40951222Seric
41059081Sericifdef(`_NO_UUCP_', `dnl',
41159081Seric`ifdef(`UUCP_RELAY',
41251274Seric`# pass UUCP addresses straight through
41355416SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
41451274Seric`# if really UUCP, handle it immediately
41551322Sericifdef(`_CLASS_U_',
41655416Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
41751322Sericifdef(`_CLASS_V_',
41855416Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
41951322Sericifdef(`_CLASS_W_',
42055416Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42151322Sericifdef(`_CLASS_X_',
42255416Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42351322Sericifdef(`_CLASS_Y_',
42455416Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42551267Seric
42651267Seric# try UUCP traffic as a local address
42755416SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
42851992Sericifdef(`_OLD_SENDMAIL_',
42955416Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
43055416Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
43159081Seric')
43261470Sericifdef(`_NO_CANONIFY_',
43361470Seric`# make sure local host names appear canonical
43461470SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3',
43559081Seric`# pass to name server to make hostname canonical
43661470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
43761470Seric
43851889Sericundivert(8)dnl
43951889Seric
44051322Seric# if this is the local hostname, make sure we treat is as canonical
44151322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
44251222Seric
44351322Seric
44451222Seric##################################################
44551222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
44651222Seric##################################################
44751222SericS4
44851222Seric
44958499SericR$*<@>			$@ $1				handle <> and list:;
45051222Seric
45151222Seric# resolve numeric addresses to name if possible
45251322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
45351222Seric
45451322Seric# strip trailing dot off possibly canonical name
45551322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
45651322Seric
45751222Seric# externalize local domain info
45851322SericR$* < $+ > $*		$1 $2 $3			defocus
45951322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
46051997SericR@ $*			$@ @ $1				... and exit
46151222Seric
46258288Sericifdef(`_NO_UUCP_', `dnl',
46358288Seric`# UUCP must always be presented in old form
46458288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
46551222Seric
46651222Seric# delete duplicate local names
46751322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
46851222Seric
46951222Seric
47051222Seric
47160894Seric##############################################################
47260894Seric###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
47360894Seric###		   (used for recursive calls)		   ###
47460894Seric##############################################################
47551222Seric
47660894SericS`'_SET_97_
47751222SericR$*			$: $>3 $1
47851222SericR$*			$@ $>0 $1
47951222Seric
48051222Seric
48151222Seric######################################
48251222Seric###   Ruleset 0 -- Parse Address   ###
48351222Seric######################################
48451222Seric
48551222SericS0
48651222Seric
48758562SericR<@>			$#local $: <>			special case error msgs
48859887SericR$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
48958340Seric
49055416Sericifdef(`_MAILER_smtp_',
49155416Seric`# handle numeric address spec
492*63858Sericifdef(`_NO_CANONIFY_',
493*63858Seric`R$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr',
494*63858Seric	`dnl')
495*63858SericR$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
496*63858SericR$* < @ [ $+ ] > $*	$#smtp $@ [$2] $: $1 @ [$2] $3	still numeric: send',
497*63858Seric	`dnl')
49851222Seric
49951887Seric# now delete the local info -- note $=O to find characters that cause forwarding
50060894SericR$* < @ > $*		$@ $>_SET_97_ $1			user@ => user
50160894SericR< @ $=w . > : $*	$@ $>_SET_97_ $2			@here:... -> ...
50260894SericR$* $=O $* < @ $=w . >	$@ $>_SET_97_ $1 $2 $3			...@here -> ...
50358781Sericifdef(`MAILER_TABLE',
50458781Seric`
50558781Seric# try mailer table lookup
50660540SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
50761106SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
50862582SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
50961106SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
51062582SericR< $+ > $*		$: $>90 <$1> $2			try domain',
51158781Seric`dnl')
51251222Seric
51351222Seric# short circuit local delivery so forwarded email works
51458516Sericifdef(`_LOCAL_NOT_STICKY_',
51560894Seric`R$=L < @ $=w . >		$#local $: @ $1			special local names
51660894SericR$+ < @ $=w . >		$#local $: $1			dispose directly',
51760894Seric`R$+ < @ $=w . >		$: $1 < @ $2 @ $H >		first try hub
51851992Sericifdef(`_OLD_SENDMAIL_',
51959635Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
52059635SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
52157527SericR$+ < $+ @ >		$#local $: $1			nope, local address',
52257527Seric`R$+ < $+ @ $+ >		$#local $: $1			yep ....
52358516SericR$+ < $+ @ >		$#local $: @ $1			nope, local address')')
524*63858Seric
525*63858Seric# handle local hacks
526*63858SericR$*			$: $>_SET_98_ $1
52751260Sericundivert(4)dnl
52851260Seric
52961468Sericifdef(`_NO_UUCP_', `dnl',
53061468Seric`# resolve remotely connected UUCP links (if any)
53151285Sericifdef(`_CLASS_V_',
532*63858Seric`R$* < @ $=V . UUCP > $*		$: < $V > <@ $V> : $1 @ $2.UUCP $3
533*63858SericR< $- : $+ > $*			$# $1 $@ $2 $: $3	$=V UUCP routing
534*63858SericR< $+ > $*			$#smtp $@ $1 $: $2
535*63858SericR<> $*				$: $1			else strip off gunk',
53652044Seric	`dnl')
53751285Sericifdef(`_CLASS_W_',
538*63858Seric`R$* < @ $=W . UUCP > $*		$: < $W > <@ $W> : $1 @ $2.UUCP $3
539*63858SericR< $- : $+ > $*			$# $1 $@ $2 $: $3	$=W UUCP routing
540*63858SericR< $+ > $*			$#smtp $@ $1 $: $2
541*63858SericR<> $*				$: $1			else strip off gunk',
54252044Seric	`dnl')
54351285Sericifdef(`_CLASS_X_',
544*63858Seric`R$* < @ $=X . UUCP > $*		$: < $X > <@ $X> : $1 @ $2.UUCP $3
545*63858SericR< $- : $+ > $*			$# $1 $@ $2 $: $3	$=X UUCP routing
546*63858SericR< $+ > $*			$#smtp $@ $1 $: $2
547*63858SericR<> $*				$: $1			else strip off gunk',
54861468Seric	`dnl')')
54951260Seric
55051222Seric# resolve fake top level domains by forwarding to other hosts
55151222Sericifdef(`BITNET_RELAY',
552*63858Seric`R$*<@$+.BITNET>$*	$: < $B > $1 <@$2.BITNET> $3	user@host.BITNET
553*63858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
554*63858SericR< $+ > $*		$#smtp $@ $1 $: $2
555*63858SericR<> $*			$: $1				else strip off gunk',
55651222Seric	`dnl')
55751222Sericifdef(`CSNET_RELAY',
558*63858Seric`R$*<@$+.CSNET>$*	$: < $C > $1 <@$2.CSNET> $3	user@host.CSNET
559*63858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
560*63858SericR< $+ > $*		$#smtp $@ $1 $: $2
561*63858SericR<> $*			$: $1				else strip off gunk',
56251222Seric	`dnl')
56358364Sericifdef(`_MAILER_fax_',
564*63858Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1		user@host.FAX',
56558364Seric`ifdef(`FAX_RELAY',
566*63858Seric`R$*<@$+.FAX>$*		$: < $F > $1 <@$2.FAX> $3	user@host.FAX
567*63858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
568*63858SericR< $+ > $*		$#smtp $@ $1 $: $2',
569*63858SericR<> $*			$: $1				else strip off gunk',
57058364Seric	`dnl')')
57151222Seric
57251260Sericifdef(`UUCP_RELAY',
57351260Seric`# forward non-local UUCP traffic to our UUCP relay
574*63858SericR$*<@$*.UUCP>$*		$: < $Y > <@ $Y> : $1 @ $2.UUCP $3	uucp mail
575*63858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
576*63858SericR< $+ > $*		$#smtp $@ $1 $: $2',
577*63858SericR<> $*			$: $1				else strip off gunk',
57855416Seric`ifdef(`_MAILER_uucp_',
57951260Seric`# forward other UUCP traffic straight to UUCP
580*63858SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2		@host.UUCP:...
581*63858SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1		user@host.UUCP',
58251260Seric	`dnl')')
58351222Seric
58463754Sericifdef(`_MAILER_USENET_', `
58563754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
58663754SericR$+ . USENET		$# usenet $: $1',
58763754Seric`dnl')
58863754Seric
58958070Sericifdef(`_LOCAL_RULES_',
59058070Seric`# figure out what should stay in our local mail system
59163754Sericundivert(1)', `dnl')
59263754Seric
59358070Sericifdef(`SMART_HOST', `
59458070Seric# pass names that still have a host to a smarthost
59558070SericR$* < @ $* > $*		$: < $S > $1 < @ $2 > $3	glue on smarthost name
596*63858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		if non-null, use it
597*63858SericR< $+ > $*		$#suucp $@ $1 $: $2		if non-null, use it
598*63858SericR<> $*			$: $1				else strip off gunk',
59963754Seric
60058070Seric`ifdef(`_LOCAL_RULES_', `
60158070Seric# reject messages that have host names we do not understand
60258070SericR$* < @ $* > $*		$#error $@ NOHOST $: Unrecognized host name $2',
60363754Seric`ifdef(`_MAILER_smtp_',
60463754Seric`# deal with other remote names
60563754SericR$* < @ $* > $*		$#smtp $@ $2 $: $1 < @ $2 > $3		user@host.domain')')')
60651222Seric
60751992Sericifdef(`_OLD_SENDMAIL_',
60851887Seric`# forward remaining names to local relay, if any
60952041SericR$=L			$#local $: $1			special local names
61052041SericR$+			$: $1 < @ $R >			append relay
61157527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
61257527SericR$+ < @ >		$#local $: $1			no relay or hub: local
61360894SericR$+ < @ $=w  >		$#local $: $1			we are relay/hub: local
61458070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		deliver to relay/hub
61558771SericR$+ < @ $+ >		$#relay $@ $2 $: $1		deliver to relay/hub',
61658811Seric
61758811Seric`# if this is quoted, strip the quotes and try again
61858811SericR$+			$: $(dequote $1 $)		strip quotes
61960894SericR$* $=O $*		$@ $>_SET_97_ $1 $2 $3			try again
62058811Seric
62158811Seric# handle locally delivered names
62252041SericR$=L			$#local $: @ $1			special local names
62352041SericR$+			$#local $: $1			regular local names
62451222Seric
62555416Seric###########################################################################
62655416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
62755416Seric###		   (new sendmail only)					###
62855416Seric###########################################################################
62951222Seric
63051322SericS5
63151322Seric
63258808Seric# see if we have a relay or a hub
63358808SericR$+			$: $1 < @ $R >
63457527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
63560894SericR$+ < @ $=w >		$@ $1				we are relay/hub: local
63658070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		send to relay or hub
63758808Sericifdef(`_MAILER_smtp_',
63858808Seric`R$+ < @ $+ >		$#relay $@ $2 $: $1		send to relay or hub')')
63960540Sericifdef(`MAILER_TABLE',
64060540Seric`
64160540Seric
642*63858Seric###################################################################
643*63858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
644*63858Seric###		   (new sendmail only)				###
645*63858Seric###################################################################
64660540Seric
64760540SericS90
64861106SericR<$- . $+ > $*		$: < $(mailertable .$2 $) > $3	lookup
64960540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
65062372SericR< . $+ > $*		$@ $>90 <$1> $2			no -- strip & try again
65160540SericR<$*> $*		$@ $2				no match',
65260540Seric`dnl')
653*63858Seric
654*63858Seric###################################################################
655*63858Seric###  Ruleset _SET_98_ -- local part of ruleset zero (can be null)	###
656*63858Seric###################################################################
657*63858Seric
658*63858SericS`'_SET_98_
659*63858Sericundivert(3)dnl
66051222Seric#
66151222Seric######################################################################
66251222Seric######################################################################
66351222Seric#####
66456790Seric`#####			MAILER DEFINITIONS'
66551222Seric#####
66651222Seric######################################################################
66751222Seric######################################################################
66851222Sericundivert(7)dnl
669