MAILDROP_README.html revision 1.1.1.2 1 1.1 tron <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2 1.1 tron "http://www.w3.org/TR/html4/loose.dtd">
3 1.1 tron
4 1.1 tron <html>
5 1.1 tron
6 1.1 tron <head>
7 1.1 tron
8 1.1 tron <title>Postfix + Maildrop Howto</title>
9 1.1 tron
10 1.1 tron <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
11 1.1 tron
12 1.1 tron </head>
13 1.1 tron
14 1.1 tron <body>
15 1.1 tron
16 1.1 tron <h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix + Maildrop Howto</h1>
17 1.1 tron
18 1.1 tron <hr>
19 1.1 tron
20 1.1 tron <h2> Introduction </h2>
21 1.1 tron
22 1.1 tron <p> This document discusses various options to plug the maildrop
23 1.1 tron delivery agent into Postfix: </p>
24 1.1 tron
25 1.1 tron <ul>
26 1.1 tron
27 1.1 tron <li><a href="#direct">Direct delivery without the local delivery agent</a>
28 1.1 tron
29 1.1 tron <li><a href="#indirect">Indirect delivery via the local delivery agent</a>
30 1.1 tron
31 1.1 tron <li><a href="#credits">Credits</a>
32 1.1 tron
33 1.1 tron </ul>
34 1.1 tron
35 1.1 tron <h2><a name="direct">Direct delivery without the local delivery agent</a></h2>
36 1.1 tron
37 1.1 tron <p> Postfix can be configured to deliver mail directly to maildrop,
38 1.1 tron without using the local(8) delivery agent as an intermediate. This
39 1.1 tron means that you do not get local aliases(5) expansion or $HOME/.forward
40 1.1 tron file processing. You would typically do this for hosted domains with
41 1.1 tron recipients that don't have UNIX home directories. </p>
42 1.1 tron
43 1.1 tron <p> The following example shows how to use maildrop for some.domain
44 1.1 tron and for someother.domain. The example comes in two parts. </p>
45 1.1 tron
46 1.1 tron <p> Part 1 describes changes to the main.cf file: </p>
47 1.1 tron
48 1.1 tron <blockquote>
49 1.1 tron <pre>
50 1.1 tron 1 /etc/postfix/main.cf:
51 1.1 tron 2 maildrop_destination_recipient_limit = 1
52 1.1 tron 3 virtual_mailbox_domains = some.domain someother.domain
53 1.1 tron 4 virtual_transport = maildrop
54 1.1 tron 5 virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
55 1.1 tron 6 virtual_alias_maps = hash:/etc/postfix/virtual_alias
56 1.1 tron 7
57 1.1 tron 8 /etc/postfix/virtual_mailbox:
58 1.1 tron 9 user1 (a] some.domain <i>...text here does not matter...</i>
59 1.1 tron 10 user2 (a] some.domain <i>...text here does not matter...</i>
60 1.1 tron 11 user3 (a] someother.domain <i>...text here does not matter...</i>
61 1.1 tron 12
62 1.1 tron 13 /etc/postfix/virtual_alias:
63 1.1 tron 14 postmaster (a] some.domain postmaster
64 1.1 tron 15 postmaster (a] someother.domain postmaster
65 1.1 tron </pre>
66 1.1 tron </blockquote>
67 1.1 tron
68 1.1 tron <ul>
69 1.1 tron
70 1.1 tron <li> <p> Line 2 is needed so that Postfix will provide one recipient
71 1.1 tron at a time to the maildrop delivery agent. </p>
72 1.1 tron
73 1.1 tron <li> <p> Line 3 informs Postfix that some.domain and someother.domain
74 1.1 tron are so-called virtual mailbox domains.
75 1.1 tron Instead of listing the names in main.cf you can also
76 1.1 tron list them in a file; see the virtual_mailbox_domains documentation for
77 1.1 tron details. </p>
78 1.1 tron
79 1.1 tron <li> <p> Line 4 specifies that mail for some.domain and someother.domain
80 1.1 tron should be delivered by the maildrop delivery agent. </p>
81 1.1 tron
82 1.1 tron <li> <p> Lines 5 and 8-11 specify what recipients the Postfix SMTP
83 1.1 tron server should receive mail for. This prevents the mail queue from
84 1.1 tron becoming clogged with undeliverable messages. Specify an empty
85 1.1 tron value ("virtual_mailbox_maps =") to disable this feature. </p>
86 1.1 tron
87 1.1 tron <li> <p> Lines 6 and 13-15 redirect mail for postmaster to the
88 1.1 tron local postmaster. RFC 821 requires that every domain has a postmaster
89 1.1 tron address. </p>
90 1.1 tron
91 1.1 tron </ul>
92 1.1 tron
93 1.1 tron <p> The vmail userid as used below is the user that maildrop should
94 1.1 tron run as. This would be the owner of the virtual mailboxes if they
95 1.1 tron all have the same owner. If maildrop is suid (see maildrop
96 1.1 tron documentation), then maildrop will change to the appropriate owner
97 1.1 tron to deliver the mail. </p>
98 1.1 tron
99 1.1 tron <p> Note: Do not use the postfix user as the maildrop user. </p>
100 1.1 tron
101 1.1 tron <p> Part 2 describes changes to the master.cf file: </p>
102 1.1 tron
103 1.1 tron <blockquote>
104 1.1 tron <pre>
105 1.1 tron /etc/postfix/master.cf:
106 1.1 tron maildrop unix - n n - - pipe
107 1.1 tron flags=ODRhu user=vmail argv=/path/to/maildrop -d ${recipient}
108 1.1 tron </pre>
109 1.1 tron </blockquote>
110 1.1 tron
111 1.1 tron <p> The pipe(8) manual page gives a detailed description of the
112 1.1 tron above command line arguments, and more. </p>
113 1.1 tron
114 1.1 tron <p> If you want to support user+extension@domain style addresses,
115 1.1 tron use the following instead: </p>
116 1.1 tron
117 1.1 tron <blockquote>
118 1.1 tron <pre>
119 1.1 tron /etc/postfix/master.cf:
120 1.1 tron maildrop unix - n n - - pipe
121 1.1 tron flags=ODRhu user=vmail argv=/path/to/maildrop
122 1.1.1.2 tron -d ${user}@${domain} ${extension} ${recipient} ${user} ${nexthop}
123 1.1 tron </pre>
124 1.1 tron </blockquote>
125 1.1 tron
126 1.1.1.2 tron <p> The mail is delivered to ${user}@${domain} (search key for
127 1.1 tron maildrop userdb lookup). The ${extension} and the other address
128 1.1 tron components are available to maildrop rules as $1, $2, $3, ... and
129 1.1 tron can be omitted from master.cf or ignored by maildrop when not
130 1.1 tron needed. </p>
131 1.1 tron
132 1.1.1.2 tron <p> With Postfix 2.4 and earlier, use ${nexthop} instead of ${domain}.
133 1.1.1.2 tron </p>
134 1.1.1.2 tron
135 1.1 tron <h2><a name="indirect">Indirect delivery via the local delivery agent</a></h2>
136 1.1 tron
137 1.1 tron <p> Postfix can be configured to deliver mail to maildrop via the
138 1.1 tron local delivery agent. This is slightly less efficient than the
139 1.1 tron "direct" approach discussed above, but gives you the convenience
140 1.1 tron of local aliases(5) expansion and $HOME/.forward file processing.
141 1.1 tron You would typically use this for domains that are listed in
142 1.1 tron mydestination and that have users with a UNIX system account. </p>
143 1.1 tron
144 1.1 tron <p> To configure maildrop delivery for all UNIX system accounts: </p>
145 1.1 tron
146 1.1 tron <blockquote>
147 1.1 tron <pre>
148 1.1 tron /etc/postfix/main.cf:
149 1.1 tron mailbox_command = /path/to/maildrop -d ${USER}
150 1.1 tron </pre>
151 1.1 tron </blockquote>
152 1.1 tron
153 1.1 tron <p> Note: ${USER} is spelled in upper case. </p>
154 1.1 tron
155 1.1 tron <p> To enable maildrop delivery for specific users only, you can
156 1.1 tron use the Postfix local(8) delivery agent's mailbox_command_maps feature:
157 1.1 tron </p>
158 1.1 tron
159 1.1 tron <blockquote>
160 1.1 tron <pre>
161 1.1 tron /etc/postfix/main.cf:
162 1.1 tron mailbox_command_maps = hash:/etc/postfix/mailbox_commands
163 1.1 tron
164 1.1 tron /etc/postfix/mailbox_commands:
165 1.1 tron you /path/to/maildrop -d ${USER}
166 1.1 tron </pre>
167 1.1 tron </blockquote>
168 1.1 tron
169 1.1 tron <p> Maildrop delivery for specific users is also possible by
170 1.1 tron invoking it from the user's $HOME/.forward file: </p>
171 1.1 tron
172 1.1 tron <blockquote>
173 1.1 tron <pre>
174 1.1 tron /home/you/.forward:
175 1.1 tron "|/path/to/maildrop -d ${USER}"
176 1.1 tron </pre>
177 1.1 tron </blockquote>
178 1.1 tron
179 1.1 tron <h2><a name="credits">Credits</a></h2>
180 1.1 tron
181 1.1 tron <ul>
182 1.1 tron
183 1.1 tron <li> The original text was kindly provided by Russell Mosemann.
184 1.1 tron
185 1.1 tron <li> Victor Duchovni provided tips for supporting user+foo@domain
186 1.1 tron addresses.
187 1.1 tron
188 1.1 tron <li> Tonni Earnshaw contributed text about delivery via the local(8)
189 1.1 tron delivery agent.
190 1.1 tron
191 1.1 tron </ul>
192 1.1 tron
193 1.1 tron </body>
194 1.1 tron
195 1.1 tron </html>
196