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