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