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}@${nexthop} ${extension} ${recipient} ${user} ${nexthop} 123</pre> 124</blockquote> 125 126<p> The mail is delivered to ${user}@${nexthop} (match 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<h2><a name="indirect">Indirect delivery via the local delivery agent</a></h2> 133 134<p> Postfix can be configured to deliver mail to maildrop via the 135local delivery agent. This is slightly less efficient than the 136"direct" approach discussed above, but gives you the convenience 137of local aliases(5) expansion and $HOME/.forward file processing. 138You would typically use this for domains that are listed in 139mydestination and that have users with a UNIX system account. </p> 140 141<p> To configure maildrop delivery for all UNIX system accounts: </p> 142 143<blockquote> 144<pre> 145/etc/postfix/main.cf: 146 mailbox_command = /path/to/maildrop -d ${USER} 147</pre> 148</blockquote> 149 150<p> Note: ${USER} is spelled in upper case. </p> 151 152<p> To enable maildrop delivery for specific users only, you can 153use the Postfix local(8) delivery agent's mailbox_command_maps feature: 154</p> 155 156<blockquote> 157<pre> 158/etc/postfix/main.cf: 159 mailbox_command_maps = hash:/etc/postfix/mailbox_commands 160 161/etc/postfix/mailbox_commands: 162 you /path/to/maildrop -d ${USER} 163</pre> 164</blockquote> 165 166<p> Maildrop delivery for specific users is also possible by 167invoking it from the user's $HOME/.forward file: </p> 168 169<blockquote> 170<pre> 171/home/you/.forward: 172 "|/path/to/maildrop -d ${USER}" 173</pre> 174</blockquote> 175 176<h2><a name="credits">Credits</a></h2> 177 178<ul> 179 180<li> The original text was kindly provided by Russell Mosemann. 181 182<li> Victor Duchovni provided tips for supporting user+foo@domain 183addresses. 184 185<li> Tonni Earnshaw contributed text about delivery via the local(8) 186delivery agent. 187 188</ul> 189 190</body> 191 192</html> 193