9 Postfix virtual alias table format
13 \fBpostmap /etc/postfix/virtual\fR
15 \fBpostmap -q "\fIstring\fB" /etc/postfix/virtual\fR
17 \fBpostmap -q - /etc/postfix/virtual <\fIinputfile\fR
21 The optional \fBvirtual\fR(5) alias table rewrites recipient
22 addresses for all local, all virtual, and all remote mail
24 This is unlike the \fBaliases\fR(5) table which is used
25 only for \fBlocal\fR(8) delivery. Virtual aliasing is
26 recursive, and is implemented by the Postfix \fBcleanup\fR(8)
27 daemon before mail is queued.
29 The main applications of virtual aliasing are:
31 To redirect mail for one address to one or more addresses.
33 To implement virtual alias domains where all addresses are aliased
34 to addresses in other domains.
36 Virtual alias domains are not to be confused with the virtual mailbox
37 domains that are implemented with the Postfix \fBvirtual\fR(8) mail
38 delivery agent. With virtual mailbox domains, each recipient address
39 can have its own mailbox.
41 Virtual aliasing is applied only to recipient
42 envelope addresses, and does not affect message headers.
43 Use \fBcanonical\fR(5)
44 mapping to rewrite header and envelope addresses in general.
46 Normally, the \fBvirtual\fR(5) alias table is specified as a text file
47 that serves as input to the \fBpostmap\fR(1) command.
48 The result, an indexed file in \fBdbm\fR or \fBdb\fR format,
49 is used for fast searching by the mail system. Execute the command
50 "\fBpostmap /etc/postfix/virtual\fR" to rebuild an indexed
51 file after changing the corresponding text file.
53 When the table is provided via other means such as NIS, LDAP
54 or SQL, the same lookups are done as for ordinary indexed files.
56 Alternatively, the table can be provided as a regular-expression
57 map where patterns are given as regular expressions, or lookups
58 can be directed to TCP-based server. In those case, the lookups
59 are done in a slightly different way as described below under
60 "REGULAR EXPRESSION TABLES" or "TCP-BASED TABLES".
66 The search string is folded to lowercase before database
67 lookup. As of Postfix 2.3, the search string is not case
68 folded with database types such as regexp: or pcre: whose
69 lookup fields can match both upper and lower case.
75 The input format for the \fBpostmap\fR(1) command is as follows:
76 .IP "\fIpattern result\fR"
77 When \fIpattern\fR matches a mail address, replace it by the
78 corresponding \fIresult\fR.
79 .IP "blank lines and comments"
80 Empty lines and whitespace-only lines are ignored, as
81 are lines whose first non-whitespace character is a `#'.
83 A logical line starts with non-whitespace text. A line that
84 starts with whitespace continues a logical line.
85 .SH "TABLE SEARCH ORDER"
90 With lookups from indexed files such as DB or DBM, or from networked
91 tables such as NIS, LDAP or SQL, patterns are tried in the order as
93 .IP "\fIuser\fR@\fIdomain address, address, ...\fR"
94 Redirect mail for \fIuser\fR@\fIdomain\fR to \fIaddress\fR.
95 This form has the highest precedence.
96 .IP "\fIuser address, address, ...\fR"
97 Redirect mail for \fIuser\fR@\fIsite\fR to \fIaddress\fR when
98 \fIsite\fR is equal to $\fBmyorigin\fR, when \fIsite\fR is listed in
99 $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR
100 or $\fBproxy_interfaces\fR.
102 This functionality overlaps with functionality of the local
103 \fIaliases\fR(5) database. The difference is that \fBvirtual\fR(5)
104 mapping can be applied to non-local addresses.
105 .IP "@\fIdomain address, address, ...\fR"
106 Redirect mail for other users in \fIdomain\fR to \fIaddress\fR.
107 This form has the lowest precedence.
109 Note: @\fIdomain\fR is a wild-card. With this form, the
110 Postfix SMTP server accepts
111 mail for any recipient in \fIdomain\fR, regardless of whether
112 that recipient exists. This may turn your mail system into
113 a backscatter source: Postfix first accepts mail for
114 non-existent recipients and then tries to return that mail
115 as "undeliverable" to the often forged sender address.
116 .SH "RESULT ADDRESS REWRITING"
121 The lookup result is subject to address rewriting:
123 When the result has the form @\fIotherdomain\fR, the
124 result becomes the same \fIuser\fR in \fIotherdomain\fR.
125 This works only for the first address in a multi-address
128 When "\fBappend_at_myorigin=yes\fR", append "\fB@$myorigin\fR"
129 to addresses without "@domain".
131 When "\fBappend_dot_mydomain=yes\fR", append
132 "\fB.$mydomain\fR" to addresses without ".domain".
133 .SH "ADDRESS EXTENSION"
138 When a mail address localpart contains the optional recipient delimiter
139 (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes:
140 \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR,
141 \fIuser\fR, and @\fIdomain\fR.
143 The \fBpropagate_unmatched_extensions\fR parameter controls whether
144 an unmatched address extension (\fI+foo\fR) is propagated to the
145 result of table lookup.
146 .SH "VIRTUAL ALIAS DOMAINS"
151 Besides virtual aliases, the virtual alias table can also be used
152 to implement virtual alias domains. With a virtual alias domain, all
153 recipient addresses are aliased to addresses in other domains.
155 Virtual alias domains are not to be confused with the virtual mailbox
156 domains that are implemented with the Postfix \fBvirtual\fR(8) mail
157 delivery agent. With virtual mailbox domains, each recipient address
158 can have its own mailbox.
160 With a virtual alias domain, the virtual domain has its
161 own user name space. Local (i.e. non-virtual) usernames are not
162 visible in a virtual alias domain. In particular, local
163 \fBaliases\fR(5) and local mailing lists are not visible as
164 \fIlocalname@virtual-alias.domain\fR.
166 Support for a virtual alias domain looks like:
169 /etc/postfix/main.cf:
170 virtual_alias_maps = hash:/etc/postfix/virtual
173 Note: some systems use \fBdbm\fR databases instead of \fBhash\fR.
174 See the output from "\fBpostconf -m\fR" for available database types.
177 /etc/postfix/virtual:
178 \fIvirtual-alias.domain anything\fR (right-hand content does not matter)
179 \fIpostmaster@virtual-alias.domain postmaster\fR
180 \fIuser1@virtual-alias.domain address1\fR
181 \fIuser2@virtual-alias.domain address2, address3\fR
184 The \fIvirtual-alias.domain anything\fR entry is required for a
185 virtual alias domain. \fBWithout this entry, mail is rejected
186 with "relay access denied", or bounces with
187 "mail loops back to myself".\fR
189 Do not specify virtual alias domain names in the \fBmain.cf
190 mydestination\fR or \fBrelay_domains\fR configuration parameters.
192 With a virtual alias domain, the Postfix SMTP server
193 accepts mail for \fIknown-user@virtual-alias.domain\fR, and rejects
194 mail for \fIunknown-user\fR@\fIvirtual-alias.domain\fR as undeliverable.
196 Instead of specifying the virtual alias domain name via
197 the \fBvirtual_alias_maps\fR table, you may also specify it via
198 the \fBmain.cf virtual_alias_domains\fR configuration parameter.
199 This latter parameter uses the same syntax as the \fBmain.cf
200 mydestination\fR configuration parameter.
201 .SH "REGULAR EXPRESSION TABLES"
206 This section describes how the table lookups change when the table
207 is given in the form of regular expressions. For a description of
208 regular expression lookup table syntax, see \fBregexp_table\fR(5)
209 or \fBpcre_table\fR(5).
211 Each pattern is a regular expression that is applied to the entire
212 address being looked up. Thus, \fIuser@domain\fR mail addresses are not
213 broken up into their \fIuser\fR and \fI@domain\fR constituent parts,
214 nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR.
216 Patterns are applied in the order as specified in the table, until a
217 pattern is found that matches the search string.
219 Results are the same as with indexed file lookups, with
220 the additional feature that parenthesized substrings from the
221 pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on.
222 .SH "TCP-BASED TABLES"
227 This section describes how the table lookups change when lookups
228 are directed to a TCP-based server. For a description of the TCP
229 client/server lookup protocol, see \fBtcp_table\fR(5).
230 This feature is not available up to and including Postfix version 2.4.
232 Each lookup operation uses the entire address once. Thus,
233 \fIuser@domain\fR mail addresses are not broken up into their
234 \fIuser\fR and \fI@domain\fR constituent parts, nor is
235 \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR.
237 Results are the same as with indexed file lookups.
241 The table format does not understand quoting conventions.
242 .SH "CONFIGURATION PARAMETERS"
247 The following \fBmain.cf\fR parameters are especially relevant to
248 this topic. See the Postfix \fBmain.cf\fR file for syntax details
249 and for default values. Use the "\fBpostfix reload\fR" command after
250 a configuration change.
251 .IP \fBvirtual_alias_maps\fR
252 List of virtual aliasing tables.
253 .IP \fBvirtual_alias_domains\fR
254 List of virtual alias domains. This uses the same syntax
255 as the \fBmydestination\fR parameter.
256 .IP \fBpropagate_unmatched_extensions\fR
257 A list of address rewriting or forwarding mechanisms that propagate
258 an address extension from the original address to the result.
259 Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR,
260 \fBforward\fR, \fBinclude\fR, or \fBgeneric\fR.
262 Other parameters of interest:
263 .IP \fBinet_interfaces\fR
264 The network interface addresses that this system receives mail on.
265 You need to stop and start Postfix when this parameter changes.
266 .IP \fBmydestination\fR
267 List of domains that this mail system considers local.
269 The domain that is appended to any address that does not have a domain.
270 .IP \fBowner_request_special\fR
271 Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR
273 .IP \fBproxy_interfaces\fR
274 Other interfaces that this machine receives mail on by way of a
275 proxy agent or network address translator.
279 cleanup(8), canonicalize and enqueue mail
280 postmap(1), Postfix lookup table manager
281 postconf(5), configuration parameters
282 canonical(5), canonical address mapping
288 Use "\fBpostconf readme_directory\fR" or
289 "\fBpostconf html_directory\fR" to locate this information.
292 ADDRESS_REWRITING_README, address rewriting guide
293 DATABASE_README, Postfix lookup table overview
294 VIRTUAL_README, domain hosting guide
300 The Secure Mailer license must be distributed with this software.
305 IBM T.J. Watson Research
307 Yorktown Heights, NY 10598, USA