xref: /freebsd/contrib/sendmail/cf/mailer/smtp.m4 (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1PUSHDIVERT(-1)
2#
3# Copyright (c) 1998-2001, 2006 Proofpoint, 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#
14_DEFIFNOT(`_DEF_SMTP_MAILER_FLAGS', `mDFMuX')
15_DEFIFNOT(`SMTP_MAILER_FLAGS',`')
16_DEFIFNOT(`SMTP_MAILER_LL',`990')
17_DEFIFNOT(`RELAY_MAILER_LL',`2040')
18_DEFIFNOT(`RELAY_MAILER_FLAGS', `SMTP_MAILER_FLAGS')
19ifdef(`SMTP_MAILER_ARGS',, `define(`SMTP_MAILER_ARGS', `TCP $h')')
20ifdef(`ESMTP_MAILER_ARGS',, `define(`ESMTP_MAILER_ARGS', `TCP $h')')
21ifdef(`SMTP8_MAILER_ARGS',, `define(`SMTP8_MAILER_ARGS', `TCP $h')')
22ifdef(`DSMTP_MAILER_ARGS',, `define(`DSMTP_MAILER_ARGS', `TCP $h')')
23ifdef(`RELAY_MAILER_ARGS',, `define(`RELAY_MAILER_ARGS', `TCP $h')')
24define(`_SMTP_QGRP', `ifelse(defn(`SMTP_MAILER_QGRP'),`',`', ` Q=SMTP_MAILER_QGRP,')')dnl
25define(`_ESMTP_QGRP', `ifelse(defn(`ESMTP_MAILER_QGRP'),`',`', ` Q=ESMTP_MAILER_QGRP,')')dnl
26define(`_SMTP8_QGRP', `ifelse(defn(`SMTP8_MAILER_QGRP'),`',`', ` Q=SMTP8_MAILER_QGRP,')')dnl
27define(`_DSMTP_QGRP', `ifelse(defn(`DSMTP_MAILER_QGRP'),`',`', ` Q=DSMTP_MAILER_QGRP,')')dnl
28define(`_RELAY_QGRP', `ifelse(defn(`RELAY_MAILER_QGRP'),`',`', ` Q=RELAY_MAILER_QGRP,')')dnl
29POPDIVERT
30#####################################
31###   SMTP Mailer specification   ###
32#####################################
33
34VERSIONID(`$Id: smtp.m4,v 8.66 2013-11-22 20:51:14 ca Exp $')
35
36#
37#  common sender and masquerading recipient rewriting
38#
39SMasqSMTP
40R$* < @ $* > $*		$@ $1 < @ $2 > $3		already fully qualified
41R$+			$@ $1 < @ *LOCAL* >		add local qualification
42
43#
44#  convert pseudo-domain addresses to real domain addresses
45#
46SPseudoToReal
47
48# pass <route-addr>s through
49R< @ $+ > $*		$@ < @ $1 > $2			resolve <route-addr>
50
51# output fake domains as user%fake@relay
52ifdef(`BITNET_RELAY',
53`R$+ <@ $+ .BITNET. >	$: $1 % $2 .BITNET < @ $B >	user@host.BITNET
54R$+.BITNET <@ $~[ $*:$+ >	$: $1 .BITNET < @ $4 >	strip mailer: part',
55	`dnl')
56ifdef(`_NO_UUCP_', `dnl', `
57# do UUCP heuristics; note that these are shared with UUCP mailers
58R$+ < @ $+ .UUCP. >	$: < $2 ! > $1			convert to UUCP form
59R$+ < @ $* > $*		$@ $1 < @ $2 > $3		not UUCP form
60
61# leave these in .UUCP form to avoid further tampering
62R< $&h ! > $- ! $+	$@ $2 < @ $1 .UUCP. >
63R< $&h ! > $-.$+ ! $+	$@ $3 < @ $1.$2 >
64R< $&h ! > $+		$@ $1 < @ $&h .UUCP. >
65R< $+ ! > $+		$: $1 ! $2 < @ $Y >		use UUCP_RELAY
66R$+ < @ $~[ $* : $+ >	$@ $1 < @ $4 >			strip mailer: part
67R$+ < @ >		$: $1 < @ *LOCAL* >		if no UUCP_RELAY')
68
69
70#
71#  envelope sender rewriting
72#
73SEnvFromSMTP
74R$+			$: $>PseudoToReal $1		sender/recipient common
75R$* :; <@>		$@				list:; special case
76R$*			$: $>MasqSMTP $1		qualify unqual'ed names
77R$+			$: $>MasqEnv $1			do masquerading
78
79
80#
81#  envelope recipient rewriting --
82#  also header recipient if not masquerading recipients
83#
84SEnvToSMTP
85R$+			$: $>PseudoToReal $1		sender/recipient common
86R$+			$: $>MasqSMTP $1		qualify unqual'ed names
87R$* < @ *LOCAL* > $*	$: $1 < @ $j . > $2
88
89#
90#  header sender and masquerading header recipient rewriting
91#
92SHdrFromSMTP
93R$+			$: $>PseudoToReal $1		sender/recipient common
94R:; <@>			$@				list:; special case
95
96# do special header rewriting
97R$* <@> $*		$@ $1 <@> $2			pass null host through
98R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
99R$*			$: $>MasqSMTP $1		qualify unqual'ed names
100R$+			$: $>MasqHdr $1			do masquerading
101
102
103#
104#  relay mailer header masquerading recipient rewriting
105#
106SMasqRelay
107R$+			$: $>MasqSMTP $1
108R$+			$: $>MasqHdr $1
109
110Msmtp,		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=SMTP_MAILER_LL,
111		_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
112		A=SMTP_MAILER_ARGS
113Mesmtp,		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=SMTP_MAILER_LL,
114		_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
115		A=ESMTP_MAILER_ARGS
116Msmtp8,		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=SMTP_MAILER_LL,
117		_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
118		A=SMTP8_MAILER_ARGS
119Mdsmtp,		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=SMTP_MAILER_LL,
120		_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
121		A=DSMTP_MAILER_ARGS
122Mrelay,		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=RELAY_MAILER_LL,
123		_OPTINS(`RELAY_MAILER_CHARSET', `C=', `, ')_OPTINS(`RELAY_MAILER_MAXMSGS', `m=', `, ')_OPTINS(`SMTP_MAILER_MAXRCPTS', `r=', `, ')T=DNS/RFC822/SMTP,_RELAY_QGRP
124		A=RELAY_MAILER_ARGS
125