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