xref: /titanic_44/usr/src/cmd/sendmail/cf/mailer/smtp.m4 (revision 3c112a2b34403220c06c3e2fcac403358cfba168)
1PUSHDIVERT(-1)
2#
3# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
4#	All rights reserved.
5# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
6# Copyright (c) 1988, 1993
7#	The Regents of the University of California.  All rights reserved.
8#
9# By using this file, you agree to the terms and conditions set
10# forth in the LICENSE file which can be found at the top level of
11# the sendmail distribution.
12#
13#ident	"%Z%%M%	%I%	%E% SMI"
14#
15_DEFIFNOT(`_DEF_SMTP_MAILER_FLAGS', `mDFMuX')
16_DEFIFNOT(`SMTP_MAILER_FLAGS',`')
17_DEFIFNOT(`RELAY_MAILER_FLAGS', `SMTP_MAILER_FLAGS')
18ifdef(`SMTP_MAILER_ARGS',, `define(`SMTP_MAILER_ARGS', `TCP $h')')
19ifdef(`ESMTP_MAILER_ARGS',, `define(`ESMTP_MAILER_ARGS', `TCP $h')')
20ifdef(`SMTP8_MAILER_ARGS',, `define(`SMTP8_MAILER_ARGS', `TCP $h')')
21ifdef(`DSMTP_MAILER_ARGS',, `define(`DSMTP_MAILER_ARGS', `TCP $h')')
22ifdef(`RELAY_MAILER_ARGS',, `define(`RELAY_MAILER_ARGS', `TCP $h')')
23define(`_SMTP_QGRP', `ifelse(defn(`SMTP_MAILER_QGRP'),`',`', ` Q=SMTP_MAILER_QGRP,')')dnl
24define(`_ESMTP_QGRP', `ifelse(defn(`ESMTP_MAILER_QGRP'),`',`', ` Q=ESMTP_MAILER_QGRP,')')dnl
25define(`_SMTP8_QGRP', `ifelse(defn(`SMTP8_MAILER_QGRP'),`',`', ` Q=SMTP8_MAILER_QGRP,')')dnl
26define(`_DSMTP_QGRP', `ifelse(defn(`DSMTP_MAILER_QGRP'),`',`', ` Q=DSMTP_MAILER_QGRP,')')dnl
27define(`_RELAY_QGRP', `ifelse(defn(`RELAY_MAILER_QGRP'),`',`', ` Q=RELAY_MAILER_QGRP,')')dnl
28POPDIVERT
29#####################################
30###   SMTP Mailer specification   ###
31#####################################
32
33VERSIONID(`$Id: smtp.m4,v 8.64 2001/04/03 01:52:54 gshapiro Exp $')
34
35#
36#  common sender and masquerading recipient rewriting
37#
38SMasqSMTP
39R$* < @ $* > $*		$@ $1 < @ $2 > $3		already fully qualified
40R$+			$@ $1 < @ *LOCAL* >		add local qualification
41
42#
43#  convert pseudo-domain addresses to real domain addresses
44#
45SPseudoToReal
46
47# pass <route-addr>s through
48R< @ $+ > $*		$@ < @ $1 > $2			resolve <route-addr>
49
50# output fake domains as user%fake@relay
51ifdef(`BITNET_RELAY',
52`R$+ <@ $+ .BITNET. >	$: $1 % $2 .BITNET < @ $B >	user@host.BITNET
53R$+.BITNET <@ $~[ $*:$+ >	$: $1 .BITNET < @ $4 >	strip mailer: part',
54	`dnl')
55ifdef(`_NO_UUCP_', `dnl', `
56# do UUCP heuristics; note that these are shared with UUCP mailers
57R$+ < @ $+ .UUCP. >	$: < $2 ! > $1			convert to UUCP form
58R$+ < @ $* > $*		$@ $1 < @ $2 > $3		not UUCP form
59
60# leave these in .UUCP form to avoid further tampering
61R< $&h ! > $- ! $+	$@ $2 < @ $1 .UUCP. >
62R< $&h ! > $-.$+ ! $+	$@ $3 < @ $1.$2 >
63R< $&h ! > $+		$@ $1 < @ $&h .UUCP. >
64R< $+ ! > $+		$: $1 ! $2 < @ $Y >		use UUCP_RELAY
65R$+ < @ $~[ $* : $+ >	$@ $1 < @ $4 >			strip mailer: part
66R$+ < @ >		$: $1 < @ *LOCAL* >		if no UUCP_RELAY')
67
68
69#
70#  envelope sender rewriting
71#
72SEnvFromSMTP
73R$+			$: $>PseudoToReal $1		sender/recipient common
74R$* :; <@>		$@				list:; special case
75R$*			$: $>MasqSMTP $1		qualify unqual'ed names
76R$+			$: $>MasqEnv $1			do masquerading
77
78
79#
80#  envelope recipient rewriting --
81#  also header recipient if not masquerading recipients
82#
83SEnvToSMTP
84R$+			$: $>PseudoToReal $1		sender/recipient common
85R$+			$: $>MasqSMTP $1		qualify unqual'ed names
86R$* < @ *LOCAL* > $*	$: $1 < @ $j . > $2
87
88#
89#  header sender and masquerading header recipient rewriting
90#
91SHdrFromSMTP
92R$+			$: $>PseudoToReal $1		sender/recipient common
93R:; <@>			$@				list:; special case
94
95# do special header rewriting
96R$* <@> $*		$@ $1 <@> $2			pass null host through
97R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
98R$*			$: $>MasqSMTP $1		qualify unqual'ed names
99R$+			$: $>MasqHdr $1			do masquerading
100
101
102#
103#  relay mailer header masquerading recipient rewriting
104#
105SMasqRelay
106R$+			$: $>MasqSMTP $1
107R$+			$: $>MasqHdr $1
108
109Msmtp,		P=[IPC], F=_MODMF_(CONCAT(_DEF_SMTP_MAILER_FLAGS, SMTP_MAILER_FLAGS), `SMTP'), S=EnvFromSMTP/HdrFromSMTP, R=ifdef(`_ALL_MASQUERADE_', `EnvToSMTP/HdrFromSMTP', `EnvToSMTP'), E=\r\n, L=990,
110		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`SMTP_MAILER_MAXRCPTS', `r=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,_SMTP_QGRP
111		A=SMTP_MAILER_ARGS
112Mesmtp,		P=[IPC], F=_MODMF_(CONCAT(_DEF_SMTP_MAILER_FLAGS, `a', SMTP_MAILER_FLAGS), `ESMTP'), S=EnvFromSMTP/HdrFromSMTP, R=ifdef(`_ALL_MASQUERADE_', `EnvToSMTP/HdrFromSMTP', `EnvToSMTP'), E=\r\n, L=990,
113		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`SMTP_MAILER_MAXRCPTS', `r=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,_ESMTP_QGRP
114		A=ESMTP_MAILER_ARGS
115Msmtp8,		P=[IPC], F=_MODMF_(CONCAT(_DEF_SMTP_MAILER_FLAGS, `8', SMTP_MAILER_FLAGS), `SMTP8'), S=EnvFromSMTP/HdrFromSMTP, R=ifdef(`_ALL_MASQUERADE_', `EnvToSMTP/HdrFromSMTP', `EnvToSMTP'), E=\r\n, L=990,
116		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`SMTP_MAILER_MAXRCPTS', `r=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,_SMTP8_QGRP
117		A=SMTP8_MAILER_ARGS
118Mdsmtp,		P=[IPC], F=_MODMF_(CONCAT(_DEF_SMTP_MAILER_FLAGS, `a%', SMTP_MAILER_FLAGS), `DSMTP'), S=EnvFromSMTP/HdrFromSMTP, R=ifdef(`_ALL_MASQUERADE_', `EnvToSMTP/HdrFromSMTP', `EnvToSMTP'), E=\r\n, L=990,
119		_OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`SMTP_MAILER_MAXRCPTS', `r=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,_DSMTP_QGRP
120		A=DSMTP_MAILER_ARGS
121Mrelay,		P=[IPC], F=_MODMF_(CONCAT(_DEF_SMTP_MAILER_FLAGS, `a8', RELAY_MAILER_FLAGS), `RELAY'), S=EnvFromSMTP/HdrFromSMTP, R=ifdef(`_ALL_MASQUERADE_', `MasqSMTP/MasqRelay', `MasqSMTP'), E=\r\n, L=2040,
122		_OPTINS(`RELAY_MAILER_CHARSET', `C=', `, ')_OPTINS(`RELAY_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`SMTP_MAILER_MAXRCPTS', `r=', `, ')T=DNS/RFC822/SMTP,_RELAY_QGRP
123		A=RELAY_MAILER_ARGS
124