blob: e1d320ee65002cf51ef05bb20da50675687c0d4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
PPoossttffiixx ++ MMaaiillddrroopp HHoowwttoo
-------------------------------------------------------------------------------
IInnttrroodduuccttiioonn
This document discusses various options to plug the maildrop delivery agent
into Postfix:
* Direct delivery without the local delivery agent
* Indirect delivery via the local delivery agent
* Credits
DDiirreecctt ddeelliivveerryy wwiitthhoouutt tthhee llooccaall ddeelliivveerryy aaggeenntt
Postfix can be configured to deliver mail directly to maildrop, without using
the local(8) delivery agent as an intermediate. This means that you do not get
local aliases(5) expansion or $HOME/.forward file processing. You would
typically do this for hosted domains with recipients that don't have UNIX home
directories.
The following example shows how to use maildrop for some.domain and for
someother.domain. The example comes in two parts.
Part 1 describes changes to the main.cf file:
1 /etc/postfix/main.cf:
2 maildrop_destination_recipient_limit = 1
3 virtual_mailbox_domains = some.domain someother.domain
4 virtual_transport = maildrop
5 virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
6 virtual_alias_maps = hash:/etc/postfix/virtual_alias
7
8 /etc/postfix/virtual_mailbox:
9 user1@some.domain ...text here does not matter...
10 user2@some.domain ...text here does not matter...
11 user3@someother.domain ...text here does not matter...
12
13 /etc/postfix/virtual_alias:
14 postmaster@some.domain postmaster
15 postmaster@someother.domain postmaster
* Line 2 is needed so that Postfix will provide one recipient at a time to
the maildrop delivery agent.
* Line 3 informs Postfix that some.domain and someother.domain are so-called
virtual mailbox domains. Instead of listing the names in main.cf you can
also list them in a file; see the virtual_mailbox_domains documentation for
details.
* Line 4 specifies that mail for some.domain and someother.domain should be
delivered by the maildrop delivery agent.
* Lines 5 and 8-11 specify what recipients the Postfix SMTP server should
receive mail for. This prevents the mail queue from becoming clogged with
undeliverable messages. Specify an empty value ("virtual_mailbox_maps =")
to disable this feature.
* Lines 6 and 13-15 redirect mail for postmaster to the local postmaster. RFC
821 requires that every domain has a postmaster address.
The vmail userid as used below is the user that maildrop should run as. This
would be the owner of the virtual mailboxes if they all have the same owner. If
maildrop is suid (see maildrop documentation), then maildrop will change to the
appropriate owner to deliver the mail.
Note: Do not use the postfix user as the maildrop user.
Part 2 describes changes to the master.cf file:
/etc/postfix/master.cf:
maildrop unix - n n - - pipe
flags=ODRhu user=vmail argv=/path/to/maildrop -d ${recipient}
The pipe(8) manual page gives a detailed description of the above command line
arguments, and more.
If you want to support user+extension@domain style addresses, use the following
instead:
/etc/postfix/master.cf:
maildrop unix - n n - - pipe
flags=ODRhu user=vmail argv=/path/to/maildrop
-d ${user}@${domain} ${extension} ${recipient} ${user} ${nexthop}
The mail is delivered to ${user}@${domain} (search key for maildrop userdb
lookup). The ${extension} and the other address components are available to
maildrop rules as $1, $2, $3, ... and can be omitted from master.cf or ignored
by maildrop when not needed.
With Postfix 2.4 and earlier, use ${nexthop} instead of ${domain}.
IInnddiirreecctt ddeelliivveerryy vviiaa tthhee llooccaall ddeelliivveerryy aaggeenntt
Postfix can be configured to deliver mail to maildrop via the local delivery
agent. This is slightly less efficient than the "direct" approach discussed
above, but gives you the convenience of local aliases(5) expansion and
$HOME/.forward file processing. You would typically use this for domains that
are listed in mydestination and that have users with a UNIX system account.
To configure maildrop delivery for all UNIX system accounts:
/etc/postfix/main.cf:
mailbox_command = /path/to/maildrop -d ${USER}
Note: ${USER} is spelled in upper case.
To enable maildrop delivery for specific users only, you can use the Postfix
local(8) delivery agent's mailbox_command_maps feature:
/etc/postfix/main.cf:
mailbox_command_maps = hash:/etc/postfix/mailbox_commands
/etc/postfix/mailbox_commands:
you /path/to/maildrop -d ${USER}
Maildrop delivery for specific users is also possible by invoking it from the
user's $HOME/.forward file:
/home/you/.forward:
"|/path/to/maildrop -d ${USER}"
CCrreeddiittss
* The original text was kindly provided by Russell Mosemann.
* Victor Duchovni provided tips for supporting user+foo@domain addresses.
* Tonni Earnshaw contributed text about delivery via the local(8) delivery
agent.
|