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