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