transport.5.html revision 1.1.1.8 1 1.1 tron <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2 1.1.1.8 christos "https://www.w3.org/TR/html4/loose.dtd">
3 1.1 tron <html> <head>
4 1.1.1.6 christos <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 1.1.1.7 christos <link rel='stylesheet' type='text/css' href='postfix-doc.css'>
6 1.1 tron <title> Postfix manual - transport(5) </title>
7 1.1 tron </head> <body> <pre>
8 1.1 tron TRANSPORT(5) TRANSPORT(5)
9 1.1 tron
10 1.1.1.8 christos <b><a name="name">NAME</a></b>
11 1.1 tron transport - Postfix transport table format
12 1.1 tron
13 1.1.1.8 christos <b><a name="synopsis">SYNOPSIS</a></b>
14 1.1 tron <b>postmap /etc/postfix/transport</b>
15 1.1 tron
16 1.1 tron <b>postmap -q "</b><i>string</i><b>" /etc/postfix/transport</b>
17 1.1 tron
18 1.1 tron <b>postmap -q - /etc/postfix/transport</b> <<i>inputfile</i>
19 1.1 tron
20 1.1.1.8 christos <b><a name="description">DESCRIPTION</a></b>
21 1.1.1.3 tron The optional <a href="transport.5.html"><b>transport</b>(5)</a> table specifies a mapping from email
22 1.1.1.3 tron addresses to message delivery transports and next-hop destinations.
23 1.1.1.3 tron Message delivery transports such as <b>local</b> or <b>smtp</b> are defined in the
24 1.1.1.3 tron <a href="master.5.html"><b>master.cf</b></a> file, and next-hop destinations are typically hosts or domain
25 1.1.1.3 tron names. The table is searched by the <a href="trivial-rewrite.8.html"><b>trivial-rewrite</b>(8)</a> daemon.
26 1.1 tron
27 1.1.1.3 tron This mapping overrides the default <i>transport</i>:<i>nexthop</i> selection that is
28 1.1.1.3 tron built into Postfix:
29 1.1 tron
30 1.1 tron <b><a href="postconf.5.html#local_transport">local_transport</a> (default: <a href="local.8.html">local</a>:$<a href="postconf.5.html#myhostname">myhostname</a>)</b>
31 1.1.1.3 tron This is the default for final delivery to domains listed with
32 1.1.1.3 tron <b><a href="postconf.5.html#mydestination">mydestination</a></b>, and for [<i>ipaddress</i>] destinations that match
33 1.1.1.3 tron <b>$<a href="postconf.5.html#inet_interfaces">inet_interfaces</a></b> or <b>$<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a></b>. The default <i>nexthop</i> des-
34 1.1.1.3 tron tination is the MTA hostname.
35 1.1 tron
36 1.1 tron <b><a href="postconf.5.html#virtual_transport">virtual_transport</a> (default: <a href="virtual.8.html">virtual</a>:)</b>
37 1.1.1.3 tron This is the default for final delivery to domains listed with
38 1.1.1.3 tron <b><a href="postconf.5.html#virtual_mailbox_domains">virtual_mailbox_domains</a></b>. The default <i>nexthop</i> destination is the
39 1.1.1.3 tron recipient domain.
40 1.1 tron
41 1.1 tron <b><a href="postconf.5.html#relay_transport">relay_transport</a> (default: relay:)</b>
42 1.1.1.3 tron This is the default for remote delivery to domains listed with
43 1.1.1.3 tron <b><a href="postconf.5.html#relay_domains">relay_domains</a></b>. In order of decreasing precedence, the <i>nexthop</i>
44 1.1.1.3 tron destination is taken from <b><a href="postconf.5.html#relay_transport">relay_transport</a></b>, <b><a href="postconf.5.html#sender_dependent_relayhost_maps">sender_depen</a>-</b>
45 1.1.1.3 tron <b><a href="postconf.5.html#sender_dependent_relayhost_maps">dent_relayhost_maps</a></b>, <b><a href="postconf.5.html#relayhost">relayhost</a></b>, or from the recipient domain.
46 1.1 tron
47 1.1 tron <b><a href="postconf.5.html#default_transport">default_transport</a> (default: <a href="smtp.8.html">smtp</a>:)</b>
48 1.1.1.3 tron This is the default for remote delivery to other destinations.
49 1.1.1.3 tron In order of decreasing precedence, the <i>nexthop</i> destination is
50 1.1.1.3 tron taken from <b><a href="postconf.5.html#sender_dependent_default_transport_maps">sender_dependent_default_transport_maps</a>,</b>
51 1.1.1.3 tron <b><a href="postconf.5.html#default_transport">default_transport</a></b>, <b><a href="postconf.5.html#sender_dependent_relayhost_maps">sender_dependent_relayhost_maps</a></b>, <b><a href="postconf.5.html#relayhost">relayhost</a></b>,
52 1.1.1.3 tron or from the recipient domain.
53 1.1.1.3 tron
54 1.1.1.3 tron Normally, the <a href="transport.5.html"><b>transport</b>(5)</a> table is specified as a text file that
55 1.1.1.3 tron serves as input to the <a href="postmap.1.html"><b>postmap</b>(1)</a> command. The result, an indexed file
56 1.1.1.3 tron in <b>dbm</b> or <b>db</b> format, is used for fast searching by the mail system.
57 1.1.1.3 tron Execute the command "<b>postmap /etc/postfix/transport</b>" to rebuild an
58 1.1.1.3 tron indexed file after changing the corresponding transport table.
59 1.1.1.3 tron
60 1.1.1.3 tron When the table is provided via other means such as NIS, LDAP or SQL,
61 1.1.1.3 tron the same lookups are done as for ordinary indexed files.
62 1.1.1.3 tron
63 1.1.1.3 tron Alternatively, the table can be provided as a regular-expression map
64 1.1.1.3 tron where patterns are given as regular expressions, or lookups can be
65 1.1.1.6 christos directed to a TCP-based server. In those case, the lookups are done in
66 1.1.1.6 christos a slightly different way as described below under "REGULAR EXPRESSION
67 1.1.1.3 tron TABLES" or "TCP-BASED TABLES".
68 1.1 tron
69 1.1.1.8 christos <b><a name="case_folding">CASE FOLDING</a></b>
70 1.1.1.3 tron The search string is folded to lowercase before database lookup. As of
71 1.1.1.3 tron Postfix 2.3, the search string is not case folded with database types
72 1.1.1.3 tron such as <a href="regexp_table.5.html">regexp</a>: or <a href="pcre_table.5.html">pcre</a>: whose lookup fields can match both upper and
73 1.1.1.3 tron lower case.
74 1.1 tron
75 1.1.1.8 christos <b><a name="table_format">TABLE FORMAT</a></b>
76 1.1 tron The input format for the <a href="postmap.1.html"><b>postmap</b>(1)</a> command is as follows:
77 1.1 tron
78 1.1 tron <i>pattern result</i>
79 1.1.1.3 tron When <i>pattern</i> matches the recipient address or domain, use the
80 1.1.1.3 tron corresponding <i>result</i>.
81 1.1 tron
82 1.1 tron blank lines and comments
83 1.1.1.3 tron Empty lines and whitespace-only lines are ignored, as are lines
84 1.1.1.3 tron whose first non-whitespace character is a `#'.
85 1.1 tron
86 1.1 tron multi-line text
87 1.1.1.3 tron A logical line starts with non-whitespace text. A line that
88 1.1.1.3 tron starts with whitespace continues a logical line.
89 1.1.1.3 tron
90 1.1.1.3 tron The <i>pattern</i> specifies an email address, a domain name, or a domain name
91 1.1.1.6 christos hierarchy, as described in section "TABLE SEARCH ORDER".
92 1.1.1.3 tron
93 1.1.1.3 tron The <i>result</i> is of the form <i>transport:nexthop</i> and specifies how or where
94 1.1.1.3 tron to deliver mail. This is described in section "RESULT FORMAT".
95 1.1 tron
96 1.1.1.8 christos <b><a name="table_search_order">TABLE SEARCH ORDER</a></b>
97 1.1.1.3 tron With lookups from indexed files such as DB or DBM, or from networked
98 1.1.1.3 tron tables such as NIS, LDAP or SQL, patterns are tried in the order as
99 1.1.1.3 tron listed below:
100 1.1 tron
101 1.1 tron <i>user+extension@domain transport</i>:<i>nexthop</i>
102 1.1.1.3 tron Deliver mail for <i>user+extension@domain</i> through <i>transport</i> to <i>nex-</i>
103 1.1.1.3 tron <i>thop</i>.
104 1.1 tron
105 1.1 tron <i>user@domain transport</i>:<i>nexthop</i>
106 1.1.1.3 tron Deliver mail for <i>user@domain</i> through <i>transport</i> to <i>nexthop</i>.
107 1.1 tron
108 1.1 tron <i>domain transport</i>:<i>nexthop</i>
109 1.1.1.3 tron Deliver mail for <i>domain</i> through <i>transport</i> to <i>nexthop</i>.
110 1.1 tron
111 1.1 tron <i>.domain transport</i>:<i>nexthop</i>
112 1.1.1.3 tron Deliver mail for any subdomain of <i>domain</i> through <i>transport</i> to
113 1.1.1.3 tron <i>nexthop</i>. This applies only when the string <b><a href="postconf.5.html#transport_maps">transport_maps</a></b> is not
114 1.1.1.3 tron listed in the <b><a href="postconf.5.html#parent_domain_matches_subdomains">parent_domain_matches_subdomains</a></b> configuration
115 1.1.1.3 tron setting. Otherwise, a domain name matches itself and its subdo-
116 1.1.1.3 tron mains.
117 1.1 tron
118 1.1 tron <b>*</b> <i>transport</i>:<i>nexthop</i>
119 1.1.1.3 tron The special pattern <b>*</b> represents any address (i.e. it functions
120 1.1.1.3 tron as the wild-card pattern, and is unique to Postfix transport
121 1.1.1.3 tron tables).
122 1.1.1.3 tron
123 1.1.1.3 tron Note 1: the null recipient address is looked up as
124 1.1.1.3 tron <b>$<a href="postconf.5.html#empty_address_recipient">empty_address_recipient</a></b>@<b>$<a href="postconf.5.html#myhostname">myhostname</a></b> (default: mailer-daemon@hostname).
125 1.1 tron
126 1.1.1.3 tron Note 2: <i>user@domain</i> or <i>user+extension@domain</i> lookup is available in
127 1.1.1.3 tron Postfix 2.0 and later.
128 1.1 tron
129 1.1.1.8 christos <b><a name="result_format">RESULT FORMAT</a></b>
130 1.1.1.3 tron The lookup result is of the form <i>transport</i><b>:</b><i>nexthop</i>. The <i>transport</i>
131 1.1.1.3 tron field specifies a mail delivery transport such as <b>smtp</b> or <b>local</b>. The
132 1.1.1.3 tron <i>nexthop</i> field specifies where and how to deliver mail.
133 1.1.1.3 tron
134 1.1.1.3 tron The transport field specifies the name of a mail delivery transport
135 1.1.1.3 tron (the first name of a mail delivery service entry in the Postfix <a href="master.5.html"><b>mas-</b>
136 1.1.1.3 tron <b>ter.cf</b></a> file).
137 1.1.1.3 tron
138 1.1.1.5 christos The nexthop field usually specifies one recipient domain or hostname.
139 1.1.1.5 christos In the case of the Postfix SMTP/LMTP client, the nexthop field may con-
140 1.1.1.5 christos tain a list of nexthop destinations separated by comma or whitespace
141 1.1.1.5 christos (Postfix 3.5 and later).
142 1.1.1.5 christos
143 1.1.1.5 christos The syntax of a nexthop destination is transport dependent. With SMTP,
144 1.1.1.5 christos specify a service on a non-default port as <i>host</i>:<i>service</i>, and disable MX
145 1.1.1.5 christos (mail exchanger) DNS lookups with [<i>host</i>] or [<i>host</i>]:<i>port</i>. The [] form is
146 1.1.1.5 christos required when you specify an IP address instead of a hostname.
147 1.1.1.3 tron
148 1.1.1.5 christos A null <i>transport</i> and null <i>nexthop</i> field means "do not change": use the
149 1.1.1.3 tron delivery transport and nexthop information that would be used when the
150 1.1.1.3 tron entire transport table did not exist.
151 1.1 tron
152 1.1.1.3 tron A non-null <i>transport</i> field with a null <i>nexthop</i> field resets the nexthop
153 1.1.1.3 tron information to the recipient domain.
154 1.1 tron
155 1.1.1.3 tron A null <i>transport</i> field with non-null <i>nexthop</i> field does not modify the
156 1.1.1.3 tron transport information.
157 1.1 tron
158 1.1.1.8 christos <b><a name="examples">EXAMPLES</a></b>
159 1.1.1.3 tron In order to deliver internal mail directly, while using a mail relay
160 1.1.1.3 tron for all other mail, specify a null entry for internal destinations (do
161 1.1.1.3 tron not change the delivery transport or the nexthop information) and spec-
162 1.1.1.3 tron ify a wildcard for all other destinations.
163 1.1 tron
164 1.1 tron <b>my.domain :</b>
165 1.1 tron <b>.my.domain :</b>
166 1.1 tron <b>* <a href="smtp.8.html">smtp</a>:outbound-relay.my.domain</b>
167 1.1 tron
168 1.1.1.3 tron In order to send mail for <b>example.com</b> and its subdomains via the <b>uucp</b>
169 1.1.1.3 tron transport to the UUCP host named <b>example</b>:
170 1.1 tron
171 1.1 tron <b>example.com uucp:example</b>
172 1.1 tron <b>.example.com uucp:example</b>
173 1.1 tron
174 1.1.1.3 tron When no nexthop host name is specified, the destination domain name is
175 1.1.1.3 tron used instead. For example, the following directs mail for <i>user</i>@<b>exam-</b>
176 1.1.1.3 tron <b>ple.com</b> via the <b>slow</b> transport to a mail exchanger for <b>example.com</b>.
177 1.1.1.3 tron The <b>slow</b> transport could be configured to run at most one delivery
178 1.1.1.3 tron process at a time:
179 1.1 tron
180 1.1 tron <b>example.com slow:</b>
181 1.1 tron
182 1.1.1.3 tron When no transport is specified, Postfix uses the transport that matches
183 1.1.1.3 tron the address domain class (see DESCRIPTION above). The following sends
184 1.1.1.3 tron all mail for <b>example.com</b> and its subdomains to host <b>gateway.exam-</b>
185 1.1.1.3 tron <b>ple.com</b>:
186 1.1 tron
187 1.1 tron <b>example.com :[gateway.example.com]</b>
188 1.1 tron <b>.example.com :[gateway.example.com]</b>
189 1.1 tron
190 1.1.1.3 tron In the above example, the [] suppress MX lookups. This prevents mail
191 1.1.1.3 tron routing loops when your machine is primary MX host for <b>example.com</b>.
192 1.1 tron
193 1.1.1.5 christos In the case of delivery via SMTP or LMTP, one may specify <i>host</i>:<i>service</i>
194 1.1.1.3 tron instead of just a host:
195 1.1 tron
196 1.1 tron <b>example.com <a href="smtp.8.html">smtp</a>:bar.example:2025</b>
197 1.1 tron
198 1.1.1.3 tron This directs mail for <i>user</i>@<b>example.com</b> to host <b>bar.example</b> port <b>2025</b>.
199 1.1.1.3 tron Instead of a numerical port a symbolic name may be used. Specify []
200 1.1.1.3 tron around the hostname if MX lookups must be disabled.
201 1.1 tron
202 1.1.1.5 christos Deliveries via SMTP or LMTP support multiple destinations (Postfix >=
203 1.1.1.5 christos 3.5):
204 1.1.1.5 christos
205 1.1.1.5 christos <b>example.com <a href="smtp.8.html">smtp</a>:bar.example, foo.example</b>
206 1.1.1.5 christos
207 1.1.1.5 christos This tries to deliver to <b>bar.example</b> before trying to deliver to
208 1.1.1.5 christos <b>foo.example</b>.
209 1.1.1.5 christos
210 1.1 tron The error mailer can be used to bounce mail:
211 1.1 tron
212 1.1 tron <b>.example.com <a href="error.8.html">error</a>:mail for *.example.com is not deliverable</b>
213 1.1 tron
214 1.1.1.3 tron This causes all mail for <i>user</i>@<i>anything</i><b>.example.com</b> to be bounced.
215 1.1 tron
216 1.1.1.8 christos <b><a name="regular_expression_tables">REGULAR EXPRESSION TABLES</a></b>
217 1.1.1.3 tron This section describes how the table lookups change when the table is
218 1.1.1.3 tron given in the form of regular expressions. For a description of regular
219 1.1.1.3 tron expression lookup table syntax, 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>.
220 1.1.1.3 tron
221 1.1.1.3 tron Each pattern is a regular expression that is applied to the entire
222 1.1.1.3 tron address being looked up. Thus, <i>some.domain.hierarchy</i> is not looked up
223 1.1.1.3 tron via its parent domains, nor is <i>user+foo@domain</i> looked up as
224 1.1.1.3 tron <i>user@domain</i>.
225 1.1.1.3 tron
226 1.1.1.3 tron Patterns are applied in the order as specified in the table, until a
227 1.1.1.3 tron pattern is found that matches the search string.
228 1.1.1.3 tron
229 1.1.1.3 tron The <a href="trivial-rewrite.8.html"><b>trivial-rewrite</b>(8)</a> server disallows regular expression substitution
230 1.1.1.3 tron of $1 etc. in regular expression lookup tables, because that could open
231 1.1.1.3 tron a security hole (Postfix version 2.3 and later).
232 1.1 tron
233 1.1.1.8 christos <b><a name="tcp-based_tables">TCP-BASED TABLES</a></b>
234 1.1.1.3 tron This section describes how the table lookups change when lookups are
235 1.1.1.3 tron directed to a TCP-based server. For a description of the TCP
236 1.1.1.3 tron client/server lookup protocol, see <a href="tcp_table.5.html"><b>tcp_table</b>(5)</a>. This feature is not
237 1.1.1.3 tron available up to and including Postfix version 2.4.
238 1.1.1.3 tron
239 1.1.1.3 tron Each lookup operation uses the entire recipient address once. Thus,
240 1.1.1.3 tron <i>some.domain.hierarchy</i> is not looked up via its parent domains, nor is
241 1.1.1.3 tron <i>user+foo@domain</i> looked up as <i>user@domain</i>.
242 1.1 tron
243 1.1 tron Results are the same as with indexed file lookups.
244 1.1 tron
245 1.1.1.8 christos <b><a name="configuration_parameters">CONFIGURATION PARAMETERS</a></b>
246 1.1.1.3 tron The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant. The text
247 1.1.1.3 tron below provides only a parameter summary. See <a href="postconf.5.html"><b>postconf</b>(5)</a> for more
248 1.1.1.3 tron details including examples.
249 1.1 tron
250 1.1.1.5 christos <b><a href="postconf.5.html#empty_address_recipient">empty_address_recipient</a> (MAILER-DAEMON)</b>
251 1.1.1.5 christos The recipient of mail addressed to the null address.
252 1.1 tron
253 1.1.1.5 christos <b><a href="postconf.5.html#parent_domain_matches_subdomains">parent_domain_matches_subdomains</a> (see 'postconf -d' output)</b>
254 1.1.1.5 christos A list of Postfix features where the pattern "example.com" also
255 1.1.1.5 christos matches subdomains of example.com, instead of requiring an
256 1.1.1.5 christos explicit ".example.com" pattern.
257 1.1.1.5 christos
258 1.1.1.5 christos <b><a href="postconf.5.html#transport_maps">transport_maps</a> (empty)</b>
259 1.1.1.5 christos Optional lookup tables with mappings from recipient address to
260 1.1.1.5 christos (message delivery transport, next-hop destination).
261 1.1 tron
262 1.1.1.8 christos <b><a name="see_also">SEE ALSO</a></b>
263 1.1 tron <a href="trivial-rewrite.8.html">trivial-rewrite(8)</a>, rewrite and resolve addresses
264 1.1 tron <a href="master.5.html">master(5)</a>, <a href="master.5.html">master.cf</a> file format
265 1.1 tron <a href="postconf.5.html">postconf(5)</a>, configuration parameters
266 1.1 tron <a href="postmap.1.html">postmap(1)</a>, Postfix lookup table manager
267 1.1 tron
268 1.1.1.8 christos <b><a name="readme_files">README FILES</a></b>
269 1.1 tron <a href="ADDRESS_REWRITING_README.html">ADDRESS_REWRITING_README</a>, address rewriting guide
270 1.1 tron <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
271 1.1 tron <a href="FILTER_README.html">FILTER_README</a>, external content filter
272 1.1 tron
273 1.1.1.8 christos <b><a name="license">LICENSE</a></b>
274 1.1.1.3 tron The Secure Mailer license must be distributed with this software.
275 1.1 tron
276 1.1 tron <b>AUTHOR(S)</b>
277 1.1 tron Wietse Venema
278 1.1 tron IBM T.J. Watson Research
279 1.1 tron P.O. Box 704
280 1.1 tron Yorktown Heights, NY 10598, USA
281 1.1 tron
282 1.1.1.4 christos Wietse Venema
283 1.1.1.4 christos Google, Inc.
284 1.1.1.4 christos 111 8th Avenue
285 1.1.1.4 christos New York, NY 10011, USA
286 1.1.1.4 christos
287 1.1 tron TRANSPORT(5)
288 1.1 tron </pre> </body> </html>
289