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