1 P
\bPo
\bos
\bst
\btf
\bfi
\bix
\bx V
\bVi
\bir
\brt
\btu
\bua
\bal
\bl D
\bDo
\bom
\bma
\bai
\bin
\bn H
\bHo
\bos
\bst
\bti
\bin
\bng
\bg H
\bHo
\bow
\bwt
\bto
\bo
3 -------------------------------------------------------------------------------
5 P
\bPu
\bur
\brp
\bpo
\bos
\bse
\be o
\bof
\bf t
\bth
\bhi
\bis
\bs d
\bdo
\boc
\bcu
\bum
\bme
\ben
\bnt
\bt
7 This document requires Postfix version 2.0 or later.
9 This document gives an overview of how Postfix can be used for hosting multiple
10 Internet domains, both for final delivery on the machine itself and for the
11 purpose of forwarding to destinations elsewhere.
13 The text not only describes delivery mechanisms that are built into Postfix,
14 but also gives pointers for using non-Postfix mail delivery software.
16 The following topics are covered:
18 * Canonical versus hosted versus other domains
19 * Local files versus network databases
20 * As simple as can be: shared domains, UNIX system accounts
21 * Postfix virtual ALIAS example: separate domains, UNIX system accounts
22 * Postfix virtual MAILBOX example: separate domains, non-UNIX accounts
23 * Non-Postfix mailbox store: separate domains, non-UNIX accounts
24 * Mail forwarding domains
28 C
\bCa
\ban
\bno
\bon
\bni
\bic
\bca
\bal
\bl v
\bve
\ber
\brs
\bsu
\bus
\bs h
\bho
\bos
\bst
\bte
\bed
\bd v
\bve
\ber
\brs
\bsu
\bus
\bs o
\bot
\bth
\bhe
\ber
\br d
\bdo
\bom
\bma
\bai
\bin
\bns
\bs
30 Most Postfix systems are f
\bfi
\bin
\bna
\bal
\bl d
\bde
\bes
\bst
\bti
\bin
\bna
\bat
\bti
\bio
\bon
\bn for only a few domain names. These
31 include the hostnames and [the IP addresses] of the machine that Postfix runs
32 on, and sometimes also include the parent domain of the hostname. The remainder
33 of this document will refer to these domains as the canonical domains. They are
34 usually implemented with the Postfix local domain address class, as defined in
35 the ADDRESS_CLASS_README file.
37 Besides the canonical domains, Postfix can be configured to be f
\bfi
\bin
\bna
\bal
\bl
38 d
\bde
\bes
\bst
\bti
\bin
\bna
\bat
\bti
\bio
\bon
\bn for any number of additional domains. These domains are called
39 hosted, because they are not directly associated with the name of the machine
40 itself. Hosted domains are usually implemented with the virtual alias domain
41 address class and/or with the virtual mailbox domain address class, as defined
42 in the ADDRESS_CLASS_README file.
44 But wait! There is more. Postfix can be configured as a backup MX host for
45 other domains. In this case Postfix is n
\bno
\bot
\bt t
\bth
\bhe
\be f
\bfi
\bin
\bna
\bal
\bl d
\bde
\bes
\bst
\bti
\bin
\bna
\bat
\bti
\bio
\bon
\bn for those
46 domains. It merely queues the mail when the primary MX host is down, and
47 forwards the mail when the primary MX host becomes available. This function is
48 implemented with the relay domain address class, as defined in the
49 ADDRESS_CLASS_README file.
51 Finally, Postfix can be configured as a transit host for sending mail across
52 the internet. Obviously, Postfix is not final destination for such mail. This
53 function is available only for authorized clients and/or users, and is
54 implemented by the default domain address class, as defined in the
55 ADDRESS_CLASS_README file.
57 L
\bLo
\boc
\bca
\bal
\bl f
\bfi
\bil
\ble
\bes
\bs v
\bve
\ber
\brs
\bsu
\bus
\bs n
\bne
\bet
\btw
\bwo
\bor
\brk
\bk d
\bda
\bat
\bta
\bab
\bba
\bas
\bse
\bes
\bs
59 The examples in this text use table lookups from local files such as DBM or
60 Berkeley DB. These are easy to debug with the p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp command:
62 Example: postmap -q info@example.com hash:/etc/postfix/virtual
64 See the documentation in LDAP_README, MYSQL_README and PGSQL_README for how to
65 replace local files by databases. The reader is strongly advised to make the
66 system work with local files before migrating to network databases, and to use
67 the p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp command to verify that network database lookups produce the exact
68 same results as local file lookup.
70 Example: postmap -q info@example.com ldap:/etc/postfix/virtual.cf
72 A
\bAs
\bs s
\bsi
\bim
\bmp
\bpl
\ble
\be a
\bas
\bs c
\bca
\ban
\bn b
\bbe
\be:
\b: s
\bsh
\bha
\bar
\bre
\bed
\bd d
\bdo
\bom
\bma
\bai
\bin
\bns
\bs,
\b, U
\bUN
\bNI
\bIX
\bX s
\bsy
\bys
\bst
\bte
\bem
\bm a
\bac
\bcc
\bco
\bou
\bun
\bnt
\bts
\bs
74 The simplest method to host an additional domain is to add the domain name to
75 the domains listed in the Postfix mydestination configuration parameter, and to
76 add the user names to the UNIX password file.
78 This approach makes no distinction between canonical and hosted domains. Each
79 username can receive mail in every domain.
81 In the examples we will use "example.com" as the domain that is being hosted on
82 the local Postfix machine.
85 mydestination = $myhostname localhost.$mydomain ... example.com
87 The limitations of this approach are:
89 * A total lack of separation: mail for info@my.host.name is delivered to the
90 same UNIX system account as mail for info@example.com.
91 * With users in the UNIX password file, administration of large numbers of
92 users becomes inconvenient.
94 The examples that follow provide solutions for both limitations.
96 P
\bPo
\bos
\bst
\btf
\bfi
\bix
\bx v
\bvi
\bir
\brt
\btu
\bua
\bal
\bl A
\bAL
\bLI
\bIA
\bAS
\bS e
\bex
\bxa
\bam
\bmp
\bpl
\ble
\be:
\b: s
\bse
\bep
\bpa
\bar
\bra
\bat
\bte
\be d
\bdo
\bom
\bma
\bai
\bin
\bns
\bs,
\b, U
\bUN
\bNI
\bIX
\bX s
\bsy
\bys
\bst
\bte
\bem
\bm a
\bac
\bcc
\bco
\bou
\bun
\bnt
\bts
\bs
98 With the approach described in this section, every hosted domain can have its
99 own info etc. email address. However, it still uses UNIX system accounts for
100 local mailbox deliveries.
102 With virtual alias domains, each hosted address is aliased to a local UNIX
103 system account or to a remote address. The example below shows how to use this
104 mechanism for the example.com domain.
106 1 /etc/postfix/main.cf:
107 2 virtual_alias_domains = example.com ...other hosted domains...
108 3 virtual_alias_maps = hash:/etc/postfix/virtual
110 5 /etc/postfix/virtual:
111 6 postmaster@example.com postmaster
112 7 info@example.com joe
113 8 sales@example.com jane
114 9 # Uncomment entry below to implement a catch-all address
115 10 # @example.com jim
116 11 ...virtual aliases for more domains...
120 * Line 2: the virtual_alias_domains setting tells Postfix that example.com is
121 a so-called virtual alias domain. If you omit this setting then Postfix
122 will reject mail (relay access denied) or will not be able to deliver it
123 (mail for example.com loops back to myself).
125 NEVER list a virtual alias domain name as a mydestination domain!
127 * Lines 3-8: the /etc/postfix/virtual file contains the virtual aliases. With
128 the example above, mail for postmaster@example.com goes to the local
129 postmaster, while mail for info@example.com goes to the UNIX account joe,
130 and mail for sales@example.com goes to the UNIX account jane. Mail for all
131 other addresses in example.com is rejected with the error message "User
134 * Line 10: the commented out entry (text after #) shows how one would
135 implement a catch-all virtual alias that receives mail for every
136 example.com address not listed in the virtual alias file. This is not
137 without risk. Spammers nowadays try to send mail from (or mail to) every
138 possible name that they can think of. A catch-all mailbox is likely to
139 receive many spam messages, and many bounces for spam messages that were
140 sent in the name of anything@example.com.
142 Execute the command "p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp /
\b/e
\bet
\btc
\bc/
\b/p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx/
\b/v
\bvi
\bir
\brt
\btu
\bua
\bal
\bl" after changing the virtual
143 file, and execute the command "p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx r
\bre
\bel
\blo
\boa
\bad
\bd" after changing the main.cf file.
145 Note: virtual aliases can resolve to a local address or to a remote address, or
146 both. They don't have to resolve to UNIX system accounts on your machine.
148 More details about the virtual alias file are given in the virtual(5) manual
149 page, including multiple addresses on the right-hand side.
151 Virtual aliasing solves one problem: it allows each domain to have its own info
152 mail address. But there still is one drawback: each virtual address is aliased
153 to a UNIX system account. As you add more virtual addresses you also add more
154 UNIX system accounts. The next section eliminates this problem.
156 P
\bPo
\bos
\bst
\btf
\bfi
\bix
\bx v
\bvi
\bir
\brt
\btu
\bua
\bal
\bl M
\bMA
\bAI
\bIL
\bLB
\bBO
\bOX
\bX e
\bex
\bxa
\bam
\bmp
\bpl
\ble
\be:
\b: s
\bse
\bep
\bpa
\bar
\bra
\bat
\bte
\be d
\bdo
\bom
\bma
\bai
\bin
\bns
\bs,
\b, n
\bno
\bon
\bn-
\b-U
\bUN
\bNI
\bIX
\bX a
\bac
\bcc
\bco
\bou
\bun
\bnt
\bts
\bs
158 As a system hosts more and more domains and users, it becomes less desirable to
159 give every user their own UNIX system account.
161 With the Postfix virtual(8) mailbox delivery agent, every recipient address can
162 have its own virtual mailbox. Unlike virtual alias domains, virtual mailbox
163 domains do not need the clumsy translation from each recipient addresses into a
164 different address, and owners of a virtual mailbox address do not need to have
165 a UNIX system account.
167 The Postfix virtual(8) mailbox delivery agent looks up the user mailbox
168 pathname, uid and gid via separate tables that are searched with the
169 recipient's mail address. Maildir style delivery is turned on by terminating
170 the mailbox pathname with "/".
172 If you find the idea of multiple tables bothersome, remember that you can
173 migrate the information (once it works), to an SQL database. If you take that
174 route, be sure to review the "local files versus databases" section at the top
177 Here is an example of a virtual mailbox domain "example.com":
179 1 /etc/postfix/main.cf:
180 2 virtual_mailbox_domains = example.com ...more domains...
181 3 virtual_mailbox_base = /var/mail/vhosts
182 4 virtual_mailbox_maps = hash:/etc/postfix/vmailbox
183 5 virtual_minimum_uid = 100
184 6 virtual_uid_maps = static:5000
185 7 virtual_gid_maps = static:5000
186 8 virtual_alias_maps = hash:/etc/postfix/virtual
188 10 /etc/postfix/vmailbox:
189 11 info@example.com example.com/info
190 12 sales@example.com example.com/sales/
191 13 # Comment out the entry below to implement a catch-all.
192 14 # @example.com example.com/catchall
193 15 ...virtual mailboxes for more domains...
195 17 /etc/postfix/virtual:
196 18 postmaster@example.com postmaster
200 * Line 2: The virtual_mailbox_domains setting tells Postfix that example.com
201 is a so-called virtual mailbox domain. If you omit this setting then
202 Postfix will reject mail (relay access denied) or will not be able to
203 deliver it (mail for example.com loops back to myself).
205 NEVER list a virtual MAILBOX domain name as a mydestination domain!
207 NEVER list a virtual MAILBOX domain name as a virtual ALIAS domain!
209 * Line 3: The virtual_mailbox_base parameter specifies a prefix for all
210 virtual mailbox pathnames. This is a safety mechanism in case someone makes
211 a mistake. It prevents mail from being delivered all over the file system.
213 * Lines 4, 10-15: The virtual_mailbox_maps parameter specifies the lookup
214 table with mailbox (or maildir) pathnames, indexed by the virtual mail
215 address. In this example, mail for info@example.com goes to the mailbox at
216 /var/mail/vhosts/example.com/info while mail for sales@example.com goes to
217 the maildir located at /var/mail/vhosts/example.com/sales/.
219 * Line 5: The virtual_minimum_uid specifies a lower bound on the mailbox or
220 maildir owner's UID. This is a safety mechanism in case someone makes a
221 mistake. It prevents mail from being written to sensitive files.
223 * Lines 6, 7: The virtual_uid_maps and virtual_gid_maps parameters specify
224 that all the virtual mailboxes are owned by a fixed uid and gid 5000. If
225 this is not what you want, specify lookup tables that are searched by the
226 recipient's mail address.
228 * Line 14: The commented out entry (text after #) shows how one would
229 implement a catch-all virtual mailbox address. Be prepared to receive a lot
230 of spam, as well as bounced spam that was sent in the name of
231 anything@example.com.
233 NEVER put a virtual MAILBOX wild-card in the virtual ALIAS file!!
235 * Lines 8, 17, 18: As you see, it is possible to mix virtual aliases with
236 virtual mailboxes. We use this feature to redirect mail for example.com's
237 postmaster address to the local postmaster. You can use the same mechanism
238 to redirect an address to a remote address.
240 * Line 18: This example assumes that in main.cf, $myorigin is listed under
241 the mydestination parameter setting. If that is not the case, specify an
242 explicit domain name on the right-hand side of the virtual alias table
243 entries or else mail will go to the wrong domain.
245 Execute the command "p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp /
\b/e
\bet
\btc
\bc/
\b/p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx/
\b/v
\bvi
\bir
\brt
\btu
\bua
\bal
\bl" after changing the virtual
246 file, execute "p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp /
\b/e
\bet
\btc
\bc/
\b/p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx/
\b/v
\bvm
\bma
\bai
\bil
\blb
\bbo
\box
\bx" after changing the vmailbox file,
247 and execute the command "p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx r
\bre
\bel
\blo
\boa
\bad
\bd" after changing the main.cf file.
249 Note: mail delivery happens with the recipient's UID/GID privileges specified
250 with virtual_uid_maps and virtual_gid_maps. Postfix 2.0 and earlier will not
251 create mailDIRs in world-writable parent directories; you must create them in
252 advance before you can use them. Postfix may be able to create mailBOX files by
253 itself, depending on parent directory write permissions, but it is safer to
254 create mailBOX files ahead of time.
256 More details about the virtual mailbox delivery agent are given in the virtual
259 N
\bNo
\bon
\bn-
\b-P
\bPo
\bos
\bst
\btf
\bfi
\bix
\bx m
\bma
\bai
\bil
\blb
\bbo
\box
\bx s
\bst
\bto
\bor
\bre
\be:
\b: s
\bse
\bep
\bpa
\bar
\bra
\bat
\bte
\be d
\bdo
\bom
\bma
\bai
\bin
\bns
\bs,
\b, n
\bno
\bon
\bn-
\b-U
\bUN
\bNI
\bIX
\bX a
\bac
\bcc
\bco
\bou
\bun
\bnt
\bts
\bs
261 This is a variation on the Postfix virtual mailbox example. Again, every hosted
262 address can have its own mailbox.
264 While non-Postfix software is being used for final delivery, some Postfix
265 concepts are still needed in order to glue everything together. For additional
266 background on this glue you may want to take a look at the virtual mailbox
267 domain class as defined in the ADDRESS_CLASS_README file.
269 The text in this section describes what things should look like from Postfix's
270 point of view. See CYRUS_README or MAILDROP_README for specific information
271 about Cyrus or about Courier maildrop.
273 Here is an example for a hosted domain example.com that delivers to a non-
274 Postfix delivery agent:
276 1 /etc/postfix/main.cf:
277 2 virtual_transport = ...see below...
278 3 virtual_mailbox_domains = example.com ...more domains...
279 4 virtual_mailbox_maps = hash:/etc/postfix/vmailbox
280 5 virtual_alias_maps = hash:/etc/postfix/virtual
282 7 /etc/postfix/vmailbox:
283 8 info@example.com whatever
284 9 sales@example.com whatever
285 10 # Comment out the entry below to implement a catch-all.
286 11 # Configure the mailbox store to accept all addresses.
287 12 # @example.com whatever
288 13 ...virtual mailboxes for more domains...
290 15 /etc/postfix/virtual:
291 16 postmaster@example.com postmaster
295 * Line 2: With delivery to a non-Postfix mailbox store for hosted domains,
296 the virtual_transport parameter usually specifies the Postfix LMTP client,
297 or the name of a master.cf entry that executes non-Postfix software via the
298 pipe delivery agent. Typical examples (use only one):
300 virtual_transport = lmtp:unix:/path/name (uses UNIX-domain socket)
301 virtual_transport = lmtp:hostname:port (uses TCP socket)
302 virtual_transport = maildrop: (uses pipe(8) to command)
304 Postfix comes ready with support for LMTP. And an example maildrop delivery
305 method is already defined in the default Postfix master.cf file. See the
306 MAILDROP_README document for more details.
308 * Line 3: The virtual_mailbox_domains setting tells Postfix that example.com
309 is delivered via the virtual_transport that was discussed in the previous
310 paragraph. If you omit this virtual_mailbox_domains setting then Postfix
311 will either reject mail (relay access denied) or will not be able to
312 deliver it (mail for example.com loops back to myself).
314 NEVER list a virtual MAILBOX domain name as a mydestination domain!
316 NEVER list a virtual MAILBOX domain name as a virtual ALIAS domain!
318 * Lines 4, 7-13: The virtual_mailbox_maps parameter specifies the lookup
319 table with all valid recipient addresses. The lookup result value is
320 ignored by Postfix. In the above example, info@example.com and
321 sales@example.com are listed as valid addresses; other mail for example.com
322 is rejected with "User unknown" by the Postfix SMTP server. It's left up to
323 the non-Postfix delivery agent to reject non-existent recipients from local
324 submission or from local alias expansion. If you intend to use LDAP, MySQL
325 or PgSQL instead of local files, be sure to review the "local files versus
326 databases" section at the top of this document!
328 * Line 12: The commented out entry (text after #) shows how one would inform
329 Postfix of the existence of a catch-all address. Again, the lookup result
330 is ignored by Postfix.
332 NEVER put a virtual MAILBOX wild-card in the virtual ALIAS file!!
334 Note: if you specify a wildcard in virtual_mailbox_maps, then you still
335 need to configure the non-Postfix mailbox store to receive mail for any
336 address in that domain.
338 * Lines 5, 15, 16: As you see above, it is possible to mix virtual aliases
339 with virtual mailboxes. We use this feature to redirect mail for
340 example.com's postmaster address to the local postmaster. You can use the
341 same mechanism to redirect any addresses to a local or remote address.
343 * Line 16: This example assumes that in main.cf, $myorigin is listed under
344 the mydestination parameter setting. If that is not the case, specify an
345 explicit domain name on the right-hand side of the virtual alias table
346 entries or else mail will go to the wrong domain.
348 Execute the command "p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp /
\b/e
\bet
\btc
\bc/
\b/p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx/
\b/v
\bvi
\bir
\brt
\btu
\bua
\bal
\bl" after changing the virtual
349 file, execute "p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp /
\b/e
\bet
\btc
\bc/
\b/p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx/
\b/v
\bvm
\bma
\bai
\bil
\blb
\bbo
\box
\bx" after changing the vmailbox file,
350 and execute the command "p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx r
\bre
\bel
\blo
\boa
\bad
\bd" after changing the main.cf file.
352 M
\bMa
\bai
\bil
\bl f
\bfo
\bor
\brw
\bwa
\bar
\brd
\bdi
\bin
\bng
\bg d
\bdo
\bom
\bma
\bai
\bin
\bns
\bs
354 Some providers host domains that have no (or only a few) local mailboxes. The
355 main purpose of these domains is to forward mail elsewhere. The following
356 example shows how to set up example.com as a mail forwarding domain:
358 1 /etc/postfix/main.cf:
359 2 virtual_alias_domains = example.com ...other hosted domains...
360 3 virtual_alias_maps = hash:/etc/postfix/virtual
362 5 /etc/postfix/virtual:
363 6 postmaster@example.com postmaster
364 7 joe@example.com joe@somewhere
365 8 jane@example.com jane@somewhere-else
366 9 # Uncomment entry below to implement a catch-all address
367 10 # @example.com jim@yet-another-site
368 11 ...virtual aliases for more domains...
372 * Line 2: The virtual_alias_domains setting tells Postfix that example.com is
373 a so-called virtual alias domain. If you omit this setting then Postfix
374 will reject mail (relay access denied) or will not be able to deliver it
375 (mail for example.com loops back to myself).
377 NEVER list a virtual alias domain name as a mydestination domain!
379 * Lines 3-11: The /etc/postfix/virtual file contains the virtual aliases.
380 With the example above, mail for postmaster@example.com goes to the local
381 postmaster, while mail for joe@example.com goes to the remote address
382 joe@somewhere, and mail for jane@example.com goes to the remote address
383 jane@somewhere-else. Mail for all other addresses in example.com is
384 rejected with the error message "User unknown".
386 * Line 10: The commented out entry (text after #) shows how one would
387 implement a catch-all virtual alias that receives mail for every
388 example.com address not listed in the virtual alias file. This is not
389 without risk. Spammers nowadays try to send mail from (or mail to) every
390 possible name that they can think of. A catch-all mailbox is likely to
391 receive many spam messages, and many bounces for spam messages that were
392 sent in the name of anything@example.com.
394 Execute the command "p
\bpo
\bos
\bst
\btm
\bma
\bap
\bp /
\b/e
\bet
\btc
\bc/
\b/p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx/
\b/v
\bvi
\bir
\brt
\btu
\bua
\bal
\bl" after changing the virtual
395 file, and execute the command "p
\bpo
\bos
\bst
\btf
\bfi
\bix
\bx r
\bre
\bel
\blo
\boa
\bad
\bd" after changing the main.cf file.
397 More details about the virtual alias file are given in the virtual(5) manual
398 page, including multiple addresses on the right-hand side.
400 M
\bMa
\bai
\bil
\bli
\bin
\bng
\bg l
\bli
\bis
\bst
\bts
\bs
402 The examples that were given above already show how to direct mail for virtual
403 postmaster addresses to a local postmaster. You can use the same method to
404 direct mail for any address to a local or remote address.
406 There is one major limitation: virtual aliases and virtual mailboxes can't
407 directly deliver to mailing list managers such as majordomo. The solution is to
408 set up virtual aliases that direct virtual addresses to the local delivery
411 /etc/postfix/main.cf:
412 virtual_alias_maps = hash:/etc/postfix/virtual
414 /etc/postfix/virtual:
415 listname-request@example.com listname-request
416 listname@example.com listname
417 owner-listname@example.com owner-listname
420 listname: "|/some/where/majordomo/wrapper ..."
422 listname-request: ...
424 This example assumes that in main.cf, $myorigin is listed under the
425 mydestination parameter setting. If that is not the case, specify an explicit
426 domain name on the right-hand side of the virtual alias table entries or else
427 mail will go to the wrong domain.
429 More information about the Postfix local delivery agent can be found in the
430 local(8) manual page.
432 Why does this example use a clumsy virtual alias instead of a more elegant
433 transport mapping? The reason is that mail for the virtual mailing list would
434 be rejected with "User unknown". In order to make the transport mapping work
435 one would still need a bunch of virtual alias or virtual mailbox table entries.
437 * In case of a virtual alias domain, there would need to be one identity
438 mapping from each mailing list address to itself.
439 * In case of a virtual mailbox domain, there would need to be a dummy mailbox
440 for each mailing list address.
442 A
\bAu
\but
\bto
\bor
\bre
\bep
\bpl
\bli
\bie
\bes
\bs
444 In order to set up an autoreply for virtual recipients while still delivering
445 mail as normal, set up a rule in a virtual alias table:
447 /etc/postfix/main.cf:
448 virtual_alias_maps = hash:/etc/postfix/virtual
450 /etc/postfix/virtual:
451 user@domain.tld user@domain.tld, user@domain.tld@autoreply.mydomain.tld
453 This delivers mail to the recipient, and sends a copy of the mail to the
454 address that produces automatic replies. The address can be serviced on a
455 different machine, or it can be serviced locally by setting up a transport map
456 entry that pipes all mail for autoreply.mydomain.tld into some script that
457 sends an automatic reply back to the sender.
459 DO NOT list autoreply.mydomain.tld in mydestination!
461 /etc/postfix/main.cf:
462 transport_maps = hash:/etc/postfix/transport
464 /etc/postfix/transport:
465 autoreply.mydomain.tld autoreply:
467 /etc/postfix/master.cf:
468 # =============================================================
469 # service type private unpriv chroot wakeup maxproc command
470 # (yes) (yes) (yes) (never) (100)
471 # =============================================================
472 autoreply unix - n n - - pipe
473 flags= user=nobody argv=/path/to/autoreply $sender $mailbox
475 This invokes /path/to/autoreply with the sender address and the user@domain.tld
476 recipient address on the command line.
478 For more information, see the pipe(8) manual page, and the comments in the
479 Postfix master.cf file.