autoupdate
[postfix-master.git] / postfix-master / virtual.5.html
blob5306885f21b6539a5bd9ecdbe407b4a66cd00d83
1 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html> <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
5 <title> Postfix manual - virtual(5) </title>
6 </head> <body> <pre>
7 VIRTUAL(5) VIRTUAL(5)
9 <b>NAME</b>
10 virtual - Postfix virtual alias table format
12 <b>SYNOPSIS</b>
13 <b>postmap /etc/postfix/virtual</b>
15 <b>postmap -q "</b><i>string</i><b>" /etc/postfix/virtual</b>
17 <b>postmap -q - /etc/postfix/virtual</b> &lt;<i>inputfile</i>
19 <b>DESCRIPTION</b>
20 The optional <a href="virtual.5.html"><b>virtual</b>(5)</a> alias table rewrites recipient
21 addresses for all local, all virtual, and all remote mail
22 destinations. This is unlike the <a href="aliases.5.html"><b>aliases</b>(5)</a> table which
23 is used only for <a href="local.8.html"><b>local</b>(8)</a> delivery. Virtual aliasing is
24 recursive, and is implemented by the Postfix <a href="cleanup.8.html"><b>cleanup</b>(8)</a>
25 daemon before mail is queued.
27 The main applications of virtual aliasing are:
29 <b>o</b> To redirect mail for one address to one or more
30 addresses.
32 <b>o</b> To implement virtual alias domains where all
33 addresses are aliased to addresses in other
34 domains.
36 Virtual alias domains are not to be confused with
37 the <a href="ADDRESS_CLASS_README.html#virtual_mailbox_class">virtual mailbox domains</a> that are implemented
38 with the Postfix <a href="virtual.8.html"><b>virtual</b>(8)</a> mail delivery agent.
39 With virtual mailbox domains, each recipient
40 address can have its own mailbox.
42 Virtual aliasing is applied only to recipient envelope
43 addresses, and does not affect message headers. Use
44 <a href="canonical.5.html"><b>canonical</b>(5)</a> mapping to rewrite header and envelope
45 addresses in general.
47 Normally, the <a href="virtual.5.html"><b>virtual</b>(5)</a> alias table is specified as a
48 text file that serves as input to the <a href="postmap.1.html"><b>postmap</b>(1)</a> command.
49 The result, an indexed file in <b>dbm</b> or <b>db</b> format, is used
50 for fast searching by the mail system. Execute the command
51 "<b>postmap /etc/postfix/virtual</b>" to rebuild an indexed file
52 after changing the corresponding text file.
54 When the table is provided via other means such as NIS,
55 LDAP or SQL, the same lookups are done as for ordinary
56 indexed files.
58 Alternatively, the table can be provided as a regular-
59 expression map where patterns are given as regular expres-
60 sions, or lookups can be directed to TCP-based server. In
61 those case, the lookups are done in a slightly different
62 way as described below under "REGULAR EXPRESSION TABLES"
63 or "TCP-BASED TABLES".
65 <b>CASE FOLDING</b>
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 <a href="regexp_table.5.html">regexp</a>: or <a href="pcre_table.5.html">pcre</a>: whose
69 lookup fields can match both upper and lower case.
71 <b>TABLE FORMAT</b>
72 The input format for the <a href="postmap.1.html"><b>postmap</b>(1)</a> command is as follows:
74 <i>pattern result</i>
75 When <i>pattern</i> matches a mail address, replace it by
76 the corresponding <i>result</i>.
78 blank lines and comments
79 Empty lines and whitespace-only lines are ignored,
80 as are lines whose first non-whitespace character
81 is a `#'.
83 multi-line text
84 A logical line starts with non-whitespace text. A
85 line that starts with whitespace continues a logi-
86 cal line.
88 <b>TABLE SEARCH ORDER</b>
89 With lookups from indexed files such as DB or DBM, or from
90 networked tables such as NIS, LDAP or SQL, patterns are
91 tried in the order as listed below:
93 <i>user</i>@<i>domain address, address, ...</i>
94 Redirect mail for <i>user</i>@<i>domain</i> to <i>address</i>. This
95 form has the highest precedence.
97 <i>user address, address, ...</i>
98 Redirect mail for <i>user</i>@<i>site</i> to <i>address</i> when <i>site</i> is
99 equal to $<b><a href="postconf.5.html#myorigin">myorigin</a></b>, when <i>site</i> is listed in $<b><a href="postconf.5.html#mydestination">mydes</a>-</b>
100 <b><a href="postconf.5.html#mydestination">tination</a></b>, or when it is listed in $<b><a href="postconf.5.html#inet_interfaces">inet_interfaces</a></b>
101 or $<b><a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a></b>.
103 This functionality overlaps with functionality of
104 the local <i>aliases</i>(5) database. The difference is
105 that <a href="virtual.5.html"><b>virtual</b>(5)</a> mapping can be applied to non-local
106 addresses.
108 @<i>domain address, address, ...</i>
109 Redirect mail for other users in <i>domain</i> to <i>address</i>.
110 This form has the lowest precedence.
112 Note: @<i>domain</i> is a wild-card. With this form, the
113 Postfix SMTP server accepts mail for any recipient
114 in <i>domain</i>, regardless of whether that recipient
115 exists. This may turn your mail system into a
116 backscatter source: Postfix first accepts mail for
117 non-existent recipients and then tries to return
118 that mail as "undeliverable" to the often forged
119 sender address.
121 <b>RESULT ADDRESS REWRITING</b>
122 The lookup result is subject to address rewriting:
124 <b>o</b> When the result has the form @<i>otherdomain</i>, the
125 result becomes the same <i>user</i> in <i>otherdomain</i>. This
126 works only for the first address in a multi-address
127 lookup result.
129 <b>o</b> When "<b><a href="postconf.5.html#append_at_myorigin">append_at_myorigin</a>=yes</b>", append "<b>@$<a href="postconf.5.html#myorigin">myorigin</a></b>"
130 to addresses without "@domain".
132 <b>o</b> When "<b><a href="postconf.5.html#append_dot_mydomain">append_dot_mydomain</a>=yes</b>", append "<b>.$<a href="postconf.5.html#mydomain">mydomain</a></b>"
133 to addresses without ".domain".
135 <b>ADDRESS EXTENSION</b>
136 When a mail address localpart contains the optional recip-
137 ient delimiter (e.g., <i>user+foo</i>@<i>domain</i>), the lookup order
138 becomes: <i>user+foo</i>@<i>domain</i>, <i>user</i>@<i>domain</i>, <i>user+foo</i>, <i>user</i>, and
139 @<i>domain</i>.
141 The <b><a href="postconf.5.html#propagate_unmatched_extensions">propagate_unmatched_extensions</a></b> parameter controls
142 whether an unmatched address extension (<i>+foo</i>) is propa-
143 gated to the result of table lookup.
145 <b>VIRTUAL ALIAS DOMAINS</b>
146 Besides virtual aliases, the virtual alias table can also
147 be used to implement <a href="ADDRESS_CLASS_README.html#virtual_alias_class">virtual alias domains</a>. With a virtual
148 alias domain, all recipient addresses are aliased to
149 addresses in other domains.
151 Virtual alias domains are not to be confused with the vir-
152 tual mailbox domains that are implemented with the Postfix
153 <a href="virtual.8.html"><b>virtual</b>(8)</a> mail delivery agent. With virtual mailbox
154 domains, each recipient address can have its own mailbox.
156 With a virtual alias domain, the virtual domain has its
157 own user name space. Local (i.e. non-virtual) usernames
158 are not visible in a <a href="ADDRESS_CLASS_README.html#virtual_alias_class">virtual alias domain</a>. In particular,
159 local <a href="aliases.5.html"><b>aliases</b>(5)</a> and local mailing lists are not visible
160 as <i>localname@virtual-alias.domain</i>.
162 Support for a <a href="ADDRESS_CLASS_README.html#virtual_alias_class">virtual alias domain</a> looks like:
164 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
165 <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = hash:/etc/postfix/virtual
167 Note: some systems use <b>dbm</b> databases instead of <b>hash</b>. See
168 the output from "<b>postconf -m</b>" for available database
169 types.
171 /etc/postfix/virtual:
172 <i>virtual-alias.domain anything</i> (right-hand content does not matter)
173 <i>postmaster@virtual-alias.domain postmaster</i>
174 <i>user1@virtual-alias.domain address1</i>
175 <i>user2@virtual-alias.domain address2, address3</i>
177 The <i>virtual-alias.domain anything</i> entry is required for a
178 <a href="ADDRESS_CLASS_README.html#virtual_alias_class">virtual alias domain</a>. <b>Without this entry, mail is rejected</b>
179 <b>with "relay access denied", or bounces with "mail loops</b>
180 <b>back to myself".</b>
182 Do not specify <a href="ADDRESS_CLASS_README.html#virtual_alias_class">virtual alias domain</a> names in the <a href="postconf.5.html"><b>main.cf</b></a>
183 <b><a href="postconf.5.html#mydestination">mydestination</a></b> or <b><a href="postconf.5.html#relay_domains">relay_domains</a></b> configuration parameters.
185 With a virtual alias domain, the Postfix SMTP server
186 accepts mail for <i>known-user@virtual-alias.domain</i>, and
187 rejects mail for <i>unknown-user</i>@<i>virtual-alias.domain</i> as
188 undeliverable.
190 Instead of specifying the virtual alias domain name via
191 the <b><a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a></b> table, you may also specify it via
192 the <a href="postconf.5.html"><b>main.cf</a> <a href="postconf.5.html#virtual_alias_domains">virtual_alias_domains</a></b> configuration parameter.
193 This latter parameter uses the same syntax as the <a href="postconf.5.html"><b>main.cf</b></a>
194 <b><a href="postconf.5.html#mydestination">mydestination</a></b> configuration parameter.
196 <b>REGULAR EXPRESSION TABLES</b>
197 This section describes how the table lookups change when
198 the table is given in the form of regular expressions. For
199 a description of regular expression lookup table syntax,
200 see <a href="regexp_table.5.html"><b>regexp_table</b>(5)</a> or <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a>.
202 Each pattern is a regular expression that is applied to
203 the entire address being looked up. Thus, <i>user@domain</i> mail
204 addresses are not broken up into their <i>user</i> and <i>@domain</i>
205 constituent parts, nor is <i>user+foo</i> broken up into <i>user</i> and
206 <i>foo</i>.
208 Patterns are applied in the order as specified in the ta-
209 ble, until a pattern is found that matches the search
210 string.
212 Results are the same as with indexed file lookups, with
213 the additional feature that parenthesized substrings from
214 the pattern can be interpolated as <b>$1</b>, <b>$2</b> and so on.
216 <b>TCP-BASED TABLES</b>
217 This section describes how the table lookups change when
218 lookups are directed to a TCP-based server. For a descrip-
219 tion of the TCP client/server lookup protocol, see <a href="tcp_table.5.html"><b>tcp_ta-</b></a>
220 <a href="tcp_table.5.html"><b>ble</b>(5)</a>. This feature is not available up to and including
221 Postfix version 2.4.
223 Each lookup operation uses the entire address once. Thus,
224 <i>user@domain</i> mail addresses are not broken up into their
225 <i>user</i> and <i>@domain</i> constituent parts, nor is <i>user+foo</i> broken
226 up into <i>user</i> and <i>foo</i>.
228 Results are the same as with indexed file lookups.
230 <b>BUGS</b>
231 The table format does not understand quoting conventions.
233 <b>CONFIGURATION PARAMETERS</b>
234 The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant
235 to this topic. See the Postfix <a href="postconf.5.html"><b>main.cf</b></a> file for syntax
236 details and for default values. Use the "<b>postfix reload</b>"
237 command after a configuration change.
239 <b><a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a></b>
240 List of virtual aliasing tables.
242 <b><a href="postconf.5.html#virtual_alias_domains">virtual_alias_domains</a></b>
243 List of <a href="ADDRESS_CLASS_README.html#virtual_alias_class">virtual alias domains</a>. This uses the same
244 syntax as the <b><a href="postconf.5.html#mydestination">mydestination</a></b> parameter.
246 <b><a href="postconf.5.html#propagate_unmatched_extensions">propagate_unmatched_extensions</a></b>
247 A list of address rewriting or forwarding mecha-
248 nisms that propagate an address extension from the
249 original address to the result. Specify zero or
250 more of <b>canonical</b>, <b>virtual</b>, <b>alias</b>, <b>forward</b>,
251 <b>include</b>, or <b>generic</b>.
253 Other parameters of interest:
255 <b><a href="postconf.5.html#inet_interfaces">inet_interfaces</a></b>
256 The network interface addresses that this system
257 receives mail on. You need to stop and start Post-
258 fix when this parameter changes.
260 <b><a href="postconf.5.html#mydestination">mydestination</a></b>
261 List of domains that this mail system considers
262 local.
264 <b><a href="postconf.5.html#myorigin">myorigin</a></b>
265 The domain that is appended to any address that
266 does not have a domain.
268 <b><a href="postconf.5.html#owner_request_special">owner_request_special</a></b>
269 Give special treatment to <b>owner-</b><i>xxx</i> and <i>xxx</i><b>-request</b>
270 addresses.
272 <b><a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a></b>
273 Other interfaces that this machine receives mail on
274 by way of a proxy agent or network address transla-
275 tor.
277 <b>SEE ALSO</b>
278 <a href="cleanup.8.html">cleanup(8)</a>, canonicalize and enqueue mail
279 <a href="postmap.1.html">postmap(1)</a>, Postfix lookup table manager
280 <a href="postconf.5.html">postconf(5)</a>, configuration parameters
281 <a href="canonical.5.html">canonical(5)</a>, canonical address mapping
283 <b>README FILES</b>
284 <a href="ADDRESS_REWRITING_README.html">ADDRESS_REWRITING_README</a>, address rewriting guide
285 <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
286 <a href="VIRTUAL_README.html">VIRTUAL_README</a>, domain hosting guide
288 <b>LICENSE</b>
289 The Secure Mailer license must be distributed with this
290 software.
292 <b>AUTHOR(S)</b>
293 Wietse Venema
294 IBM T.J. Watson Research
295 P.O. Box 704
296 Yorktown Heights, NY 10598, USA
298 VIRTUAL(5)
299 </pre> </body> </html>