xref: /freebsd/contrib/sendmail/cf/mailer/smtp.m4 (revision 7f3dea244c40159a41ab22da77a434d7c5b5e85a)
1PUSHDIVERT(-1)
2#
3# Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
4# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
5# Copyright (c) 1988, 1993
6#	The Regents of the University of California.  All rights reserved.
7#
8# By using this file, you agree to the terms and conditions set
9# forth in the LICENSE file which can be found at the top level of
10# the sendmail distribution.
11#
12#
13ifdef(`SMTP_MAILER_FLAGS',, `define(`SMTP_MAILER_FLAGS', `')')
14ifdef(`SMTP_MAILER_ARGS',, `define(`SMTP_MAILER_ARGS', `IPC $h')')
15ifdef(`ESMTP_MAILER_ARGS',, `define(`ESMTP_MAILER_ARGS', `IPC $h')')
16ifdef(`SMTP8_MAILER_ARGS',, `define(`SMTP8_MAILER_ARGS', `IPC $h')')
17ifdef(`RELAY_MAILER_ARGS',, `define(`RELAY_MAILER_ARGS', `IPC $h')')
18ifdef(`_MAILER_uucp_',
19	`errprint(`*** MAILER(smtp) must appear before MAILER(uucp)')')dnl
20POPDIVERT
21#####################################
22###   SMTP Mailer specification   ###
23#####################################
24
25VERSIONID(`@(#)smtp.m4	8.38 (Berkeley) 5/19/1998')
26
27Msmtp,		P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), E=\r\n, L=990,
28		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
29		A=SMTP_MAILER_ARGS
30Mesmtp,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), E=\r\n, L=990,
31		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
32		A=ESMTP_MAILER_ARGS
33Msmtp8,		P=[IPC], F=CONCAT(mDFMuX8, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), E=\r\n, L=990,
34		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
35		A=SMTP8_MAILER_ARGS
36Mrelay,		P=[IPC], F=CONCAT(mDFMuXa8, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `61/71', `61'), E=\r\n, L=2040,
37		_OPTINS(`RELAY_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
38		A=RELAY_MAILER_ARGS
39
40#
41#  envelope sender rewriting
42#
43S11
44R$+			$: $>51 $1			sender/recipient common
45R$* :; <@>		$@				list:; special case
46R$*			$: $>61 $1			qualify unqual'ed names
47R$+			$: $>94 $1			do masquerading
48
49
50#
51#  envelope recipient rewriting --
52#  also header recipient if not masquerading recipients
53#
54S21
55R$+			$: $>51 $1			sender/recipient common
56R$+			$: $>61 $1			qualify unqual'ed names
57
58
59#
60#  header sender and masquerading header recipient rewriting
61#
62S31
63R$+			$: $>51 $1			sender/recipient common
64R:; <@>			$@				list:; special case
65
66# do special header rewriting
67R$* <@> $*		$@ $1 <@> $2			pass null host through
68R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
69R$*			$: $>61 $1			qualify unqual'ed names
70R$+			$: $>93 $1			do masquerading
71
72
73#
74#  convert pseudo-domain addresses to real domain addresses
75#
76S51
77
78# pass <route-addr>s through
79R< @ $+ > $*		$@ < @ $1 > $2			resolve <route-addr>
80
81# output fake domains as user%fake@relay
82ifdef(`BITNET_RELAY',
83`R$+ <@ $+ .BITNET. >	$: $1 % $2 .BITNET < @ $B >	user@host.BITNET
84R$+.BITNET <@ $+:$+ >	$: $1 .BITNET < @ $3 >		strip mailer: part',
85	`dnl')
86ifdef(`_NO_UUCP_', `dnl', `
87# do UUCP heuristics; note that these are shared with UUCP mailers
88R$+ < @ $+ .UUCP. >	$: < $2 ! > $1			convert to UUCP form
89R$+ < @ $* > $*		$@ $1 < @ $2 > $3		not UUCP form
90
91# leave these in .UUCP form to avoid further tampering
92R< $&h ! > $- ! $+	$@ $2 < @ $1 .UUCP. >
93R< $&h ! > $-.$+ ! $+	$@ $3 < @ $1.$2 >
94R< $&h ! > $+		$@ $1 < @ $&h .UUCP. >
95R< $+ ! > $+		$: $1 ! $2 < @ $Y >		use UUCP_RELAY
96R$+ < @ $+ : $+ >	$@ $1 < @ $3 >			strip mailer: part
97R$+ < @ >		$: $1 < @ *LOCAL* >		if no UUCP_RELAY')
98
99
100#
101#  common sender and masquerading recipient rewriting
102#
103S61
104
105R$* < @ $* > $*		$@ $1 < @ $2 > $3		already fully qualified
106R$+			$@ $1 < @ *LOCAL* >		add local qualification
107
108
109#
110#  relay mailer header masquerading recipient rewriting
111#
112S71
113
114R$+			$: $>61 $1
115R$+			$: $>93 $1
116