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