1GENERIC(5) File Formats Manual GENERIC(5)
2
3
4
6 generic - Postfix generic table format
7
9 postmap /etc/postfix/generic
10
11 postmap -q "string" /etc/postfix/generic
12
13 postmap -q - /etc/postfix/generic <inputfile
14
16 The optional generic(5) table specifies an address mapping that applies
17 when mail is delivered. This is the opposite of canonical(5) mapping,
18 which applies when mail is received.
19
20 Typically, one would use the generic(5) table on a system that does not
21 have a valid Internet domain name and that uses something like localdo‐
22 main.local instead. The generic(5) table is then used by the smtp(8)
23 client to transform local mail addresses into valid Internet mail
24 addresses when mail has to be sent across the Internet. See the EXAM‐
25 PLE section at the end of this document.
26
27 The generic(5) mapping affects both message header addresses (i.e.
28 addresses that appear inside messages) and message envelope addresses
29 (for example, the addresses that are used in SMTP protocol commands).
30
31 Normally, the generic(5) table is specified as a text file that serves
32 as input to the postmap(1) command. The result, an indexed file in dbm
33 or db format, is used for fast searching by the mail system. Execute
34 the command "postmap /etc/postfix/generic" to rebuild an indexed file
35 after changing the corresponding text file.
36
37 When the table is provided via other means such as NIS, LDAP or SQL,
38 the same lookups are done as for ordinary indexed files.
39
40 Alternatively, the table can be provided as a regular-expression map
41 where patterns are given as regular expressions, or lookups can be
42 directed to TCP-based server. In those case, the lookups are done in a
43 slightly different way as described below under "REGULAR EXPRESSION
44 TABLES" or "TCP-BASED TABLES".
45
47 The search string is folded to lowercase before database lookup. As of
48 Postfix 2.3, the search string is not case folded with database types
49 such as regexp: or pcre: whose lookup fields can match both upper and
50 lower case.
51
53 The input format for the postmap(1) command is as follows:
54
55 pattern result
56 When pattern matches a mail address, replace it by the corre‐
57 sponding result.
58
59 blank lines and comments
60 Empty lines and whitespace-only lines are ignored, as are lines
61 whose first non-whitespace character is a `#'.
62
63 multi-line text
64 A logical line starts with non-whitespace text. A line that
65 starts with whitespace continues a logical line.
66
68 With lookups from indexed files such as DB or DBM, or from networked
69 tables such as NIS, LDAP or SQL, each user@domain query produces a
70 sequence of query patterns as described below.
71
72 Each query pattern is sent to each specified lookup table before trying
73 the next query pattern, until a match is found.
74
75 user@domain address
76 Replace user@domain by address. This form has the highest prece‐
77 dence.
78
79 user address
80 Replace user@site by address when site is equal to $myorigin,
81 when site is listed in $mydestination, or when it is listed in
82 $inet_interfaces or $proxy_interfaces.
83
84 @domain address
85 Replace other addresses in domain by address. This form has the
86 lowest precedence.
87
89 The lookup result is subject to address rewriting:
90
91 · When the result has the form @otherdomain, the result becomes
92 the same user in otherdomain.
93
94 · When "append_at_myorigin=yes", append "@$myorigin" to addresses
95 without "@domain".
96
97 · When "append_dot_mydomain=yes", append ".$mydomain" to addresses
98 without ".domain".
99
101 When a mail address localpart contains the optional recipient delimiter
102 (e.g., user+foo@domain), the lookup order becomes: user+foo@domain,
103 user@domain, user+foo, user, and @domain.
104
105 The propagate_unmatched_extensions parameter controls whether an
106 unmatched address extension (+foo) is propagated to the result of table
107 lookup.
108
110 This section describes how the table lookups change when the table is
111 given in the form of regular expressions. For a description of regular
112 expression lookup table syntax, see regexp_table(5) or pcre_table(5).
113
114 Each pattern is a regular expression that is applied to the entire
115 address being looked up. Thus, user@domain mail addresses are not bro‐
116 ken up into their user and @domain constituent parts, nor is user+foo
117 broken up into user and foo.
118
119 Patterns are applied in the order as specified in the table, until a
120 pattern is found that matches the search string.
121
122 Results are the same as with indexed file lookups, with the additional
123 feature that parenthesized substrings from the pattern can be interpo‐
124 lated as $1, $2 and so on.
125
127 This section describes how the table lookups change when lookups are
128 directed to a TCP-based server. For a description of the TCP
129 client/server lookup protocol, see tcp_table(5). This feature is not
130 available up to and including Postfix version 2.4.
131
132 Each lookup operation uses the entire address once. Thus, user@domain
133 mail addresses are not broken up into their user and @domain con‐
134 stituent parts, nor is user+foo broken up into user and foo.
135
136 Results are the same as with indexed file lookups.
137
139 The following shows a generic mapping with an indexed file. When mail
140 is sent to a remote host via SMTP, this replaces his@localdomain.local
141 by his ISP mail address, replaces her@localdomain.local by her ISP mail
142 address, and replaces other local addresses by his ISP account, with an
143 address extension of +local (this example assumes that the ISP supports
144 "+" style address extensions).
145
146 /etc/postfix/main.cf:
147 smtp_generic_maps = hash:/etc/postfix/generic
148
149 /etc/postfix/generic:
150 his@localdomain.local hisaccount@hisisp.example
151 her@localdomain.local heraccount@herisp.example
152 @localdomain.local hisaccount+local@hisisp.example
153
154 Execute the command "postmap /etc/postfix/generic" whenever the table
155 is changed. Instead of hash, some systems use dbm database files. To
156 find out what tables your system supports use the command "postconf
157 -m".
158
160 The table format does not understand quoting conventions.
161
163 The following main.cf parameters are especially relevant. The text
164 below provides only a parameter summary. See postconf(5) for more
165 details including examples.
166
167 smtp_generic_maps
168 Address mapping lookup table for envelope and header sender and
169 recipient addresses while delivering mail via SMTP.
170
171 propagate_unmatched_extensions
172 A list of address rewriting or forwarding mechanisms that propa‐
173 gate an address extension from the original address to the
174 result. Specify zero or more of canonical, virtual, alias, for‐
175 ward, include, or generic.
176
177 Other parameters of interest:
178
179 inet_interfaces
180 The network interface addresses that this system receives mail
181 on. You need to stop and start Postfix when this parameter
182 changes.
183
184 proxy_interfaces
185 Other interfaces that this machine receives mail on by way of a
186 proxy agent or network address translator.
187
188 mydestination
189 List of domains that this mail system considers local.
190
191 myorigin
192 The domain that is appended to locally-posted mail.
193
194 owner_request_special
195 Give special treatment to owner-xxx and xxx-request addresses.
196
198 postmap(1), Postfix lookup table manager
199 postconf(5), configuration parameters
200 smtp(8), Postfix SMTP client
201
203 Use "postconf readme_directory" or "postconf html_directory" to locate
204 this information.
205 ADDRESS_REWRITING_README, address rewriting guide
206 DATABASE_README, Postfix lookup table overview
207 STANDARD_CONFIGURATION_README, configuration examples
208
210 The Secure Mailer license must be distributed with this software.
211
213 A genericstable feature appears in the Sendmail MTA.
214
215 This feature is available in Postfix 2.2 and later.
216
218 Wietse Venema
219 IBM T.J. Watson Research
220 P.O. Box 704
221 Yorktown Heights, NY 10598, USA
222
223
224
225 GENERIC(5)