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 Note 1: the special pattern * represents any address (i.e. it functions
113 as the wild-card pattern).
114
115 Note 2: the null recipient address is looked up as
116 $empty_address_recipient@$myhostname (default: mailer-daemon@hostname).
117
118 Note 3: user@domain or user+extension@domain lookup is available in
119 Postfix 2.0 and later.
120
122 The lookup result is of the form transport:nexthop. The transport
123 field specifies a mail delivery transport such as smtp or local. The
124 nexthop field specifies where and how to deliver mail.
125
126 The transport field specifies the name of a mail delivery transport
127 (the first name of a mail delivery service entry in the Postfix mas‐
128 ter.cf file).
129
130 The interpretation of the nexthop field is transport dependent. In the
131 case of SMTP, specify a service on a non-default port as host:service,
132 and disable MX (mail exchanger) DNS lookups with [host] or [host]:port.
133 The [] form is required when you specify an IP address instead of a
134 hostname.
135
136 A null transport and null nexthop result means "do not change": use the
137 delivery transport and nexthop information that would be used when the
138 entire transport table did not exist.
139
140 A non-null transport field with a null nexthop field resets the nexthop
141 information to the recipient domain.
142
143 A null transport field with non-null nexthop field does not modify the
144 transport information.
145
147 In order to deliver internal mail directly, while using a mail relay
148 for all other mail, specify a null entry for internal destinations (do
149 not change the delivery transport or the nexthop information) and spec‐
150 ify a wildcard for all other destinations.
151
152 my.domain :
153 .my.domain :
154 * smtp:outbound-relay.my.domain
155
156 In order to send mail for example.com and its subdomains via the uucp
157 transport to the UUCP host named example:
158
159 example.com uucp:example
160 .example.com uucp:example
161
162 When no nexthop host name is specified, the destination domain name is
163 used instead. For example, the following directs mail for user@exam‐
164 ple.com via the slow transport to a mail exchanger for example.com.
165 The slow transport could be configured to run at most one delivery
166 process at a time:
167
168 example.com slow:
169
170 When no transport is specified, Postfix uses the transport that matches
171 the address domain class (see DESCRIPTION above). The following sends
172 all mail for example.com and its subdomains to host gateway.exam‐
173 ple.com:
174
175 example.com :[gateway.example.com]
176 .example.com :[gateway.example.com]
177
178 In the above example, the [] suppress MX lookups. This prevents mail
179 routing loops when your machine is primary MX host for example.com.
180
181 In the case of delivery via SMTP, one may specify hostname:service
182 instead of just a host:
183
184 example.com smtp:bar.example:2025
185
186 This directs mail for user@example.com to host bar.example port 2025.
187 Instead of a numerical port a symbolic name may be used. Specify []
188 around the hostname if MX lookups must be disabled.
189
190 The error mailer can be used to bounce mail:
191
192 .example.com error:mail for *.example.com is not deliverable
193
194 This causes all mail for user@anything.example.com to be bounced.
195
197 This section describes how the table lookups change when the table is
198 given in the form of regular expressions. For a description of regular
199 expression lookup table syntax, see regexp_table(5) or pcre_table(5).
200
201 Each pattern is a regular expression that is applied to the entire
202 address being looked up. Thus, some.domain.hierarchy is not looked up
203 via its parent domains, nor is user+foo@domain looked up as
204 user@domain.
205
206 Patterns are applied in the order as specified in the table, until a
207 pattern is found that matches the search string.
208
209 The trivial-rewrite(8) server disallows regular expression substitution
210 of $1 etc. in regular expression lookup tables, because that could open
211 a security hole (Postfix version 2.3 and later).
212
214 This section describes how the table lookups change when lookups are
215 directed to a TCP-based server. For a description of the TCP
216 client/server lookup protocol, see tcp_table(5). This feature is not
217 available up to and including Postfix version 2.4.
218
219 Each lookup operation uses the entire recipient address once. Thus,
220 some.domain.hierarchy is not looked up via its parent domains, nor is
221 user+foo@domain looked up as user@domain.
222
223 Results are the same as with indexed file lookups.
224
226 The following main.cf parameters are especially relevant. The text
227 below provides only a parameter summary. See postconf(5) for more
228 details including examples.
229
230 empty_address_recipient
231 The address that is looked up instead of the null sender
232 address.
233
234 parent_domain_matches_subdomains
235 List of Postfix features that use domain.tld patterns to match
236 sub.domain.tld (as opposed to requiring .domain.tld patterns).
237
238 transport_maps
239 List of transport lookup tables.
240
242 trivial-rewrite(8), rewrite and resolve addresses
243 postconf(5), configuration parameters
244 postmap(1), Postfix lookup table manager
245
247 Use "postconf readme_directory" or "postconf html_directory" to locate
248 this information.
249 ADDRESS_REWRITING_README, address rewriting guide
250 DATABASE_README, Postfix lookup table overview
251 FILTER_README, external content filter
252
254 The Secure Mailer license must be distributed with this software.
255
257 Wietse Venema
258 IBM T.J. Watson Research
259 P.O. Box 704
260 Yorktown Heights, NY 10598, USA
261
262
263
264 TRANSPORT(5)