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