9 Postfix generic table format
13 \fBpostmap /etc/postfix/generic\fR
15 \fBpostmap -q "\fIstring\fB" /etc/postfix/generic\fR
17 \fBpostmap -q - /etc/postfix/generic <\fIinputfile\fR
21 The optional \fBgeneric\fR(5) table specifies an address
22 mapping that applies when mail is delivered. This is the
23 opposite of \fBcanonical\fR(5) mapping, which applies when
26 Typically, one would use the \fBgeneric\fR(5) table on a
27 system that does not have a valid Internet domain name and
28 that uses something like \fIlocaldomain.local\fR instead.
29 The \fBgeneric\fR(5) table is then used by the \fBsmtp\fR(8)
30 client to transform local mail addresses into valid Internet
31 mail addresses when mail has to be sent across the Internet.
32 See the EXAMPLE section at the end of this document.
34 The \fBgeneric\fR(5) mapping affects both message header
35 addresses (i.e. addresses that appear inside messages) and
36 message envelope addresses (for example, the addresses that
37 are used in SMTP protocol commands).
39 Normally, the \fBgeneric\fR(5) table is specified as a
40 text file that serves as input to the \fBpostmap\fR(1)
41 command. The result, an indexed file in \fBdbm\fR or
42 \fBdb\fR format, is used for fast searching by the mail
43 system. Execute the command "\fBpostmap /etc/postfix/generic\fR"
44 to rebuild an indexed file after changing the corresponding
47 When the table is provided via other means such as NIS, LDAP
48 or SQL, the same lookups are done as for ordinary indexed files.
50 Alternatively, the table can be provided as a regular-expression
51 map where patterns are given as regular expressions, or lookups
52 can be directed to TCP-based server. In those case, the lookups
53 are done in a slightly different way as described below under
54 "REGULAR EXPRESSION TABLES" or "TCP-BASED TABLES".
60 The search string is folded to lowercase before database
61 lookup. As of Postfix 2.3, the search string is not case
62 folded with database types such as regexp: or pcre: whose
63 lookup fields can match both upper and lower case.
69 The input format for the \fBpostmap\fR(1) command is as follows:
70 .IP "\fIpattern result\fR"
71 When \fIpattern\fR matches a mail address, replace it by the
72 corresponding \fIresult\fR.
73 .IP "blank lines and comments"
74 Empty lines and whitespace-only lines are ignored, as
75 are lines whose first non-whitespace character is a `#'.
77 A logical line starts with non-whitespace text. A line that
78 starts with whitespace continues a logical line.
79 .SH "TABLE SEARCH ORDER"
84 With lookups from indexed files such as DB or DBM, or from networked
85 tables such as NIS, LDAP or SQL, patterns are tried in the order as
87 .IP "\fIuser\fR@\fIdomain address\fR"
88 Replace \fIuser\fR@\fIdomain\fR by \fIaddress\fR. This form
89 has the highest precedence.
90 .IP "\fIuser address\fR"
91 Replace \fIuser\fR@\fIsite\fR by \fIaddress\fR when \fIsite\fR is
92 equal to $\fBmyorigin\fR, when \fIsite\fR is listed in
93 $\fBmydestination\fR, or when it is listed in $\fBinet_interfaces\fR
94 or $\fBproxy_interfaces\fR.
95 .IP "@\fIdomain address\fR"
96 Replace other addresses in \fIdomain\fR by \fIaddress\fR.
97 This form has the lowest precedence.
98 .SH "RESULT ADDRESS REWRITING"
103 The lookup result is subject to address rewriting:
105 When the result has the form @\fIotherdomain\fR, the
106 result becomes the same \fIuser\fR in \fIotherdomain\fR.
108 When "\fBappend_at_myorigin=yes\fR", append "\fB@$myorigin\fR"
109 to addresses without "@domain".
111 When "\fBappend_dot_mydomain=yes\fR", append
112 "\fB.$mydomain\fR" to addresses without ".domain".
113 .SH "ADDRESS EXTENSION"
118 When a mail address localpart contains the optional recipient delimiter
119 (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes:
120 \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR,
121 \fIuser\fR, and @\fIdomain\fR.
123 The \fBpropagate_unmatched_extensions\fR parameter controls whether
124 an unmatched address extension (\fI+foo\fR) is propagated to the
125 result of table lookup.
126 .SH "REGULAR EXPRESSION TABLES"
131 This section describes how the table lookups change when the table
132 is given in the form of regular expressions. For a description of
133 regular expression lookup table syntax, see \fBregexp_table\fR(5)
134 or \fBpcre_table\fR(5).
136 Each pattern is a regular expression that is applied to the entire
137 address being looked up. Thus, \fIuser@domain\fR mail addresses are not
138 broken up into their \fIuser\fR and \fI@domain\fR constituent parts,
139 nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR.
141 Patterns are applied in the order as specified in the table, until a
142 pattern is found that matches the search string.
144 Results are the same as with indexed file lookups, with
145 the additional feature that parenthesized substrings from the
146 pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on.
147 .SH "TCP-BASED TABLES"
152 This section describes how the table lookups change when lookups
153 are directed to a TCP-based server. For a description of the TCP
154 client/server lookup protocol, see \fBtcp_table\fR(5).
155 This feature is not available up to and including Postfix version 2.4.
157 Each lookup operation uses the entire address once. Thus,
158 \fIuser@domain\fR mail addresses are not broken up into their
159 \fIuser\fR and \fI@domain\fR constituent parts, nor is
160 \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR.
162 Results are the same as with indexed file lookups.
168 The following shows a generic mapping with an indexed file.
169 When mail is sent to a remote host via SMTP, this replaces
170 \fIhis@localdomain.local\fR by his ISP mail address, replaces
171 \fIher@localdomain.local\fR by her ISP mail address, and
172 replaces other local addresses by his ISP account, with
173 an address extension of \fI+local\fR (this example assumes
174 that the ISP supports "+" style address extensions).
178 /etc/postfix/main.cf:
179 smtp_generic_maps = hash:/etc/postfix/generic
181 /etc/postfix/generic:
182 his@localdomain.local hisaccount@hisisp.example
183 her@localdomain.local heraccount@herisp.example
184 @localdomain.local hisaccount+local@hisisp.example
188 Execute the command "\fBpostmap /etc/postfix/generic\fR"
189 whenever the table is changed. Instead of \fBhash\fR, some
190 systems use \fBdbm\fR database files. To find out what
191 tables your system supports use the command "\fBpostconf
196 The table format does not understand quoting conventions.
197 .SH "CONFIGURATION PARAMETERS"
202 The following \fBmain.cf\fR parameters are especially relevant.
203 The text below provides only a parameter summary. See
204 \fBpostconf\fR(5) for more details including examples.
205 .IP \fBsmtp_generic_maps\fR
206 Address mapping lookup table for envelope and header sender
207 and recipient addresses while delivering mail via SMTP.
208 .IP \fBpropagate_unmatched_extensions\fR
209 A list of address rewriting or forwarding mechanisms that propagate
210 an address extension from the original address to the result.
211 Specify zero or more of \fBcanonical\fR, \fBvirtual\fR, \fBalias\fR,
212 \fBforward\fR, \fBinclude\fR, or \fBgeneric\fR.
214 Other parameters of interest:
215 .IP \fBinet_interfaces\fR
216 The network interface addresses that this system receives mail on.
217 You need to stop and start Postfix when this parameter changes.
218 .IP \fBproxy_interfaces\fR
219 Other interfaces that this machine receives mail on by way of a
220 proxy agent or network address translator.
221 .IP \fBmydestination\fR
222 List of domains that this mail system considers local.
224 The domain that is appended to locally-posted mail.
225 .IP \fBowner_request_special\fR
226 Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR
231 postmap(1), Postfix lookup table manager
232 postconf(5), configuration parameters
233 smtp(8), Postfix SMTP client
239 Use "\fBpostconf readme_directory\fR" or
240 "\fBpostconf html_directory\fR" to locate this information.
243 ADDRESS_REWRITING_README, address rewriting guide
244 DATABASE_README, Postfix lookup table overview
245 STANDARD_CONFIGURATION_README, configuration examples
251 The Secure Mailer license must be distributed with this software.
255 A genericstable feature appears in the Sendmail MTA.
257 This feature is available in Postfix 2.2 and later.
262 IBM T.J. Watson Research
264 Yorktown Heights, NY 10598, USA