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