1PUSHDIVERT(-1)
2#
3# Copyright (c) 1983 Eric P. Allman
4# Copyright (c) 1988, 1993
5#	The Regents of the University of California.  All rights reserved.
6#
7# %sccs.include.redist.sh%
8#
9ifdef(`SMTP_MAILER_FLAGS',,
10	`define(`SMTP_MAILER_FLAGS',
11		`ifdef(`_OLD_SENDMAIL_', `L', `')')')
12POPDIVERT
13#####################################
14###   SMTP Mailer specification   ###
15#####################################
16
17VERSIONID(`@(#)smtp.m4	8.15 (Berkeley) 02/14/94')
18
19Msmtp,		P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
20		ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h
21Mesmtp,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
22		ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h
23Mrelay,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=61, E=\r\n,
24		ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h
25
26#
27#  envelope sender and masquerading recipient rewriting
28#
29S11
30R$+			$: $>51 $1			sender/recipient common
31R$* :; <@>		$@ $1 :;			list:; special case
32R$*			$@ $>61 $1			qualify unqual'ed names
33
34
35#
36#  header recipient rewriting if not masquerading recipients
37#
38S21
39
40# do sender/recipient common rewriting
41R$+			$: $>51 $1
42
43# unqualified names (e.g., "eric") are qualified by local host
44R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
45R$+			$: $1 < @ $j >			add local domain
46
47
48#
49#  header sender and masquerading recipient rewriting
50#
51S31
52R$+			$: $>51 $1			sender/recipient common
53R$* :; <@>		$@ $1 :;			list:; special case
54
55# do special header rewriting
56R$* <@> $*		$@ $1 <@> $2			pass null host through
57R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
58R$=E < @ $=w . >	$@ $1 < @ $2 >			exposed user as is
59R$* < @ $=w . >		$: $1 < @ $2 @ $M >		masquerade as domain
60R$* < @ $+ @ >		$@ $1 < @ $2 >			in case $M undefined
61R$* < @ $+ @ $+ >	$@ $1 < @ $3 >			$M is defined -- use it
62R$*			$@ $>61 $1			qualify unqual'ed names
63
64
65#
66#  convert pseudo-domain addresses to real domain addresses
67#
68S51
69
70# pass <route-addr>s through
71R< @ $+ > $*		$@ < @ $1 > $2			resolve <route-addr>
72
73# output fake domains as user%fake@relay
74ifdef(`BITNET_RELAY',
75`R$+ <@ $+ .BITNET. >	$: $1 % $2 .BITNET < @ $B >	user@host.BITNET
76R$+.BITNET <@ $+:$+ >	$: $1 .BITNET < @ $3 >		strip mailer: part',
77	`dnl')
78ifdef(`_NO_UUCP_', `dnl', `
79# do UUCP heuristics; note that these are shared with UUCP mailers
80R$+ < @ $+ .UUCP. >	$: < $2 ! > $1			convert to UUCP form
81R$+ < @ $* > $*		$@ $1 < @ $2 > $3		not UUCP form
82
83# leave these in .UUCP form to avoid further tampering
84R< $&h ! > $- ! $+	$@ $2 < @ $1 .UUCP. >
85R< $&h ! > $-.$+ ! $+	$@ $3 < @ $1.$2 >
86R< $&h ! > $+		$@ $1 < @ $&h .UUCP. >
87R< $+ ! > $+		$: $1 ! $2 < @ $Y >
88R$+ < @ >		$: $1 < @ $j >			in case $Y undefined
89R$+ < @ $+ : $+ >	$: $1 < @ $3 >			strip mailer: part')
90
91
92#
93#  common sender and masquerading recipient rewriting
94#
95S61
96
97R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
98R$=E			$@ $1 < @ $j>			show exposed names
99R$+			$: $1 < @ $M >			user w/o host
100R$+ <@>			$: $1 < @ $j >			in case $M undefined
101