ppoossttmmaapp //eettcc//ppoossttffiixx//ttrraannssppoorrtt
ppoossttmmaapp --qq ""_s_t_r_i_n_g"" //eettcc//ppoossttffiixx//ttrraannssppoorrtt
ppoossttmmaapp --qq -- //eettcc//ppoossttffiixx//ttrraannssppoorrtt <<_i_n_p_u_t_f_i_l_e
This mapping overrides the default _t_r_a_n_s_p_o_r_t:_n_e_x_t_h_o_p selection that is built into Postfix:
Normally, the ttrraannssppoorrtt(5) table is specified as a text file that serves as input to the ppoossttmmaapp(1) command. The result, an indexed file in ddbbmm or ddbb format, is used for fast searching by the mail system. Execute the command "ppoossttmmaapp //eettcc//ppoossttffiixx//ttrraannssppoorrtt" to rebuild an indexed file after changing the corresponding transport table.
When the table is provided via other means such as NIS, LDAP or SQL, the same lookups are done as for ordinary indexed files.
Alternatively, the table can be provided as a regular-expression map where patterns are given as regular expressions, or lookups can be directed to TCP-based server. In those case, the lookups are done in a slightly different way as described below under "REGULAR EXPRESSION TABLES" or "TCP-BASED TABLES".
The search string is folded to lowercase before database lookup. As of Postfix 2.3, the search string is not case folded with database types such as regexp: or pcre: whose lookup fields can match both upper and lower case.
The input format for the ppoossttmmaapp(1) command is as follows:
The _p_a_t_t_e_r_n specifies an email address, a domain name, or a domain name hierarchy, as described in section "TABLE LOOKUP".
The _r_e_s_u_l_t is of the form _t_r_a_n_s_p_o_r_t_:_n_e_x_t_h_o_p and specifies how or where to deliver mail. This is described in section "RESULT FORMAT".
With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below:
Note 1: the null recipient address is looked up as $$eemmppttyy__aaddddrreessss__rreecciippiieenntt@$$mmyyhhoossttnnaammee (default: mailer-daemon@hostname).
Note 2: _u_s_e_r_@_d_o_m_a_i_n or _u_s_e_r_+_e_x_t_e_n_s_i_o_n_@_d_o_m_a_i_n lookup is available in Postfix 2.0 and later.
The lookup result is of the form _t_r_a_n_s_p_o_r_t::_n_e_x_t_h_o_p. The _t_r_a_n_s_p_o_r_t field specifies a mail delivery transport such as ssmmttpp or llooccaall. The _n_e_x_t_h_o_p field specifies where and how to deliver mail.
The transport field specifies the name of a mail delivery transport (the first name of a mail delivery service entry in the Postfix mmaasstteerr..ccff file).
The interpretation of the nexthop field is transport dependent. In the case of SMTP, specify a service on a non-default port as _h_o_s_t:_s_e_r_v_i_c_e, and disable MX (mail exchanger) DNS lookups with [_h_o_s_t] or [_h_o_s_t]:_p_o_r_t. The [] form is required when you specify an IP address instead of a hostname.
A null _t_r_a_n_s_p_o_r_t and null _n_e_x_t_h_o_p result means "do not change": use the delivery transport and nexthop information that would be used when the entire transport table did not exist.
A non-null _t_r_a_n_s_p_o_r_t field with a null _n_e_x_t_h_o_p field resets the nexthop information to the recipient domain.
A null _t_r_a_n_s_p_o_r_t field with non-null _n_e_x_t_h_o_p field does not modify the transport information.
In order to deliver internal mail directly, while using a mail relay for all other mail, specify a null entry for internal destinations (do not change the delivery transport or the nexthop information) and specify a wildcard for all other destinations.
mmyy..ddoommaaiinn :: ..mmyy..ddoommaaiinn :: ** ssmmttpp::oouuttbboouunndd--rreellaayy..mmyy..ddoommaaiinn
In order to send mail for eexxaammppllee..ccoomm and its subdomains via the uuuuccpp transport to the UUCP host named eexxaammppllee:
eexxaammppllee..ccoomm uuuuccpp::eexxaammppllee ..eexxaammppllee..ccoomm uuuuccpp::eexxaammppllee
When no nexthop host name is specified, the destination domain name is used instead. For example, the following directs mail for _u_s_e_r@eexxaammppllee..ccoomm via the ssllooww transport to a mail exchanger for eexxaammppllee..ccoomm. The ssllooww transport could be configured to run at most one delivery process at a time:
eexxaammppllee..ccoomm ssllooww::
When no transport is specified, Postfix uses the transport that matches the address domain class (see DESCRIPTION above). The following sends all mail for eexxaammppllee..ccoomm and its subdomains to host ggaatteewwaayy..eexxaammppllee..ccoomm:
eexxaammppllee..ccoomm ::[[ggaatteewwaayy..eexxaammppllee..ccoomm]] ..eexxaammppllee..ccoomm ::[[ggaatteewwaayy..eexxaammppllee..ccoomm]]
In the above example, the [] suppress MX lookups. This prevents mail routing loops when your machine is primary MX host for eexxaammppllee..ccoomm.
In the case of delivery via SMTP, one may specify _h_o_s_t_n_a_m_e:_s_e_r_v_i_c_e instead of just a host:
eexxaammppllee..ccoomm ssmmttpp::bbaarr..eexxaammppllee::22002255
This directs mail for _u_s_e_r@eexxaammppllee..ccoomm to host bbaarr..eexxaammppllee port 22002255. Instead of a numerical port a symbolic name may be used. Specify [] around the hostname if MX lookups must be disabled.
The error mailer can be used to bounce mail:
..eexxaammppllee..ccoomm eerrrroorr::mmaaiill ffoorr **..eexxaammppllee..ccoomm iiss nnoott ddeelliivveerraabbllee
This causes all mail for _u_s_e_r@_a_n_y_t_h_i_n_g..eexxaammppllee..ccoomm to be bounced.
This section describes how the table lookups change when the table is given in the form of regular expressions. For a description of regular expression lookup table syntax, see rreeggeexxpp__ttaabbllee(5) or ppccrree__ttaabbllee(5).
Each pattern is a regular expression that is applied to the entire address being looked up. Thus, _s_o_m_e_._d_o_m_a_i_n_._h_i_e_r_a_r_c_h_y is not looked up via its parent domains, nor is _u_s_e_r_+_f_o_o_@_d_o_m_a_i_n looked up as _u_s_e_r_@_d_o_m_a_i_n.
Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string.
The ttrriivviiaall--rreewwrriittee(8) server disallows regular expression substitution of $1 etc. in regular expression lookup tables, because that could open a security hole (Postfix version 2.3 and later).
This section describes how the table lookups change when lookups are directed to a TCP-based server. For a description of the TCP client/server lookup protocol, see ttccpp__ttaabbllee(5). This feature is not available up to and including Postfix version 2.4.
Each lookup operation uses the entire recipient address once. Thus, _s_o_m_e_._d_o_m_a_i_n_._h_i_e_r_a_r_c_h_y is not looked up via its parent domains, nor is _u_s_e_r_+_f_o_o_@_d_o_m_a_i_n looked up as _u_s_e_r_@_d_o_m_a_i_n.
Results are the same as with indexed file lookups.
The following mmaaiinn..ccff parameters are especially relevant. The text below provides only a parameter summary. See ppoossttccoonnff(5) for more details including examples.
trivial-rewrite(8), rewrite and resolve addresses master(5), master.cf file format postconf(5), configuration parameters postmap(1), Postfix lookup table manager
Use "ppoossttccoonnff rreeaaddmmee__ddiirreeccttoorryy" or "ppoossttccoonnff hhttmmll__ddiirreeccttoorryy" to locate this information.
ADDRESS_REWRITING_README, address rewriting guide DATABASE_README, Postfix lookup table overview FILTER_README, external content filter
The Secure Mailer license must be distributed with this software.
Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA