473
|
1 Using sendmail + VERP
|
|
2
|
|
3 --------------------------------------------------------------------------------
|
|
4
|
|
5 The following configuration enables VERP (http://cr.yp.to/proto/verp.txt) which
|
|
6 is useful for mailing list managers that are able to take advantage of that
|
|
7 feature.
|
|
8
|
|
9 This configuration is currently used for using the mlmmj manager
|
|
10 (http://mlmmj.mmj.dk) with VERP enabled + sendmail.
|
|
11
|
|
12 The hack consists in hooking VERP rewriting in a replacement ruleset for the
|
|
13 existing EnvFromSMTP one (called VerpEnvFromSMTP). This is going to work *only*
|
|
14 if we are splitting messages with multiple recipients in separate queue files
|
|
15 since the macro we are using for the rewriting ($u) is not set when multiple
|
|
16 rcpt are present.
|
|
17
|
|
18 The first step consists in forcing envelope splitting, this is done using the
|
|
19 QUEUE_GROUP feature, here we are definining r=1 (max 1 rcpt per message) for the
|
|
20 default queue group:
|
|
21
|
|
22
|
|
23 QUEUE_GROUP(`mqueue', `P=/var/spool/mqueue, F=f, I=1m, R=2, r=1')
|
|
24
|
|
25
|
|
26 Since we are going to split a lot it's advisable to use the FAST_SPLIT option,
|
|
27 additionally we need to enforce return-path inclusion in the local mailer:
|
|
28
|
|
29
|
|
30 define(`confFAST_SPLIT', `100')dnl
|
|
31 define(`LOCAL_SHELL_FLAGS', `eu9P')dnl
|
|
32
|
|
33
|
|
34 Then we define a regex map for matching the addresses that we are going to
|
|
35 rewrite, in our example we'll rewrite addresses like
|
|
36
|
|
37 <listname+bounces-123@domain.net>
|
|
38
|
|
39 with
|
|
40
|
|
41 <listname+bounces-123-user=foo.net@domain.net>
|
|
42
|
|
43 where user@foo.net is the recipient address of the message. So we need to apply
|
|
44 our verp ruleset *only* to those addresses. Additionally we are also adding the
|
|
45 Delivered-To header:
|
|
46
|
|
47
|
|
48 LOCAL_CONFIG
|
|
49 Kmatch_verp regex -m -a@VERP (listname\+bounces\-[0-9]+<@domain\.net\.?>)
|
|
50 H?l?Delivered-To: $u
|
|
51
|
|
52
|
|
53 Here's the ruleset, the first half of the ruleset is the existing EnvFromSMTP
|
|
54 ruleset present in default sendmail.cf, the seconf half is the VERP stuff:
|
|
55
|
|
56
|
|
57 SVerpEnvFromSMTP
|
|
58 R$+ $: $>PseudoToReal $1 sender/recipient common
|
|
59 R$* :; <@> $@ list:; special case
|
|
60 R$* $: $>MasqSMTP $1 qualify unqual'ed names
|
|
61 R$+ $: $>MasqEnv $1 do masquerading
|
|
62
|
|
63 R $* $: $(match_verp $1 $) match the address
|
|
64 R $* + $* < @ $* . > $* @VERP $: $1 + $2 - $&u < @ $3 . > $4 VERP rewrite it using $u macro and add VERP string for failsafe
|
|
65 R $* - < @ $* . > $* VERP $: $1 < @ $2 . > $3 if $u wasn't defined rewrite the address back
|
|
66 R $* - < $+ @ $+ > < @ $* . > $* VERP $: $(dequote $1 "-" $2 "=" $3 $) < @ $4 . > $5 replace the "@" in rcpt address with "="
|
|
67 R $* - $+ @ $+ < @ $* . > $* VERP $: $(dequote $1 "-" $2 "=" $3 $) < @ $4 . > $5 replace the "@" in rcpt address with "="
|
|
68
|
|
69
|
|
70 Finally we need to rewrite the mailer definition for the used mailer (typically
|
|
71 esmtp) specifying VerpEnvFromSMTP as the sender rewrite ruleset:
|
|
72
|
|
73
|
|
74 MAILER_DEFINITIONS
|
|
75 Mesmtp, P=[IPC], F=mDFMuXa, S=VerpEnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
|
|
76 T=DNS/RFC822/SMTP,
|
|
77 A=TCP $h
|
|
78
|
|
79
|
|
80
|
|
81 NOTE: for mailing list servers it's also a good idea keeping existing
|
|
82 Delivered-To headers, sendmail needs the following patch for doing this
|
|
83
|
|
84 --- sendmail/conf.c.orig 2004-07-14 21:54:23.000000000 +0000
|
|
85 +++ sendmail/conf.c 2004-12-06 15:22:05.000000000 +0000
|
|
86 @@ -117,6 +117,7 @@
|
|
87 { "content-length", H_ACHECK, NULL },
|
|
88 { "subject", H_ENCODABLE, NULL },
|
|
89 { "x-authentication-warning", H_FORCE, NULL },
|
|
90 + { "delivered-to", H_FORCE, NULL },
|
|
91
|
|
92 { NULL, 0, NULL }
|
|
93 };
|
|
94
|
|
95
|
|
96 -- lcars@gentoo.org
|