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.9 (Berkeley) 11/30/93')
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, ')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, ')A=IPC $h
23Mrelay,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=0, 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
32
33# handle unqualified names
34R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
35R$*			$@ $>61 $1
36
37
38#
39#  header recipient rewriting if not masquerading recipients
40#
41S21
42
43# do sender/recipient common rewriting
44R$+			$: $>51 $1
45
46# unqualified names (e.g., "eric") are qualified by local host
47R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
48R$+			$: $1 < @ $j >			add local domain
49
50
51#
52#  header sender and masquerading recipient rewriting
53#
54S31
55R$+			$: $>51 $1			sender/recipient common
56R$* :; <@>		$@ $1 :;			list:; special case
57
58# do special header rewriting
59R$* <@> $*		$@ $1 <@> $2			pass null host through
60R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
61R$=E < @ $=w . >	$@ $1 < @ $2 >			exposed user as is
62R$* < @ $=w . >		$: $1 < @ $M >			masquerade as domain
63R$* < @ >		$: $1 < @ $j >			in case $M undefined
64
65# handle unqualified names
66R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
67R$*			$@ $>61 $1
68
69
70#
71#  common rewriting for all SMTP addresses
72#
73S51
74
75# pass <route-addr>s through
76R< @ $+ > $*		$@ < @ $1 > $2			resolve <route-addr>
77
78# output fake domains as user%fake@relay
79ifdef(`BITNET_RELAY',
80`R$+ <@ $+ .BITNET. >	$: $1 % $2 .BITNET. < @ $B >	user@host.BITNET
81R$+.BITNET. <@ $+:$+ >	$: $1 .BITNET. < @ $3 >		strip mailer: part',
82	`dnl')
83ifdef(`CSNET_RELAY',
84`R$+ <@ $+ .CSNET. >	$: $1 % $2 .CSNET. < @ $C >	user@host.CSNET
85R$+.CSNET. <@ $+:$+ >	$: $1 .CSNET. < @ $3 >		strip mailer: part',
86	`dnl')
87ifdef(`_NO_UUCP_', `dnl',
88`R$+ <@ $+ .UUCP. >	$: $2 ! $1 < @ $j >		user@host.UUCP')
89
90
91#
92#  common sender and masquerading recipient rewriting
93#
94S61
95
96R$=E			$@ $1 < @ $j>			show exposed names
97R$+			$: $1 < @ $M >			user w/o host
98R$+ <@>			$: $1 < @ $j >			in case $M undefined
99