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