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, patterns are tried in the order as
70 listed below:
71
72 user@domain address
73 Replace user@domain by address. This form has the highest prece‐
74 dence.
75
76 user address
77 Replace user@site by address when site is equal to $myorigin,
78 when site is listed in $mydestination, or when it is listed in
79 $inet_interfaces or $proxy_interfaces.
80
81 @domain address
82 Replace other addresses in domain by address. This form has the
83 lowest precedence.
84
86 The lookup result is subject to address rewriting:
87
88 · When the result has the form @otherdomain, the result becomes
89 the same user in otherdomain.
90
91 · When "append_at_myorigin=yes", append "@$myorigin" to addresses
92 without "@domain".
93
94 · When "append_dot_mydomain=yes", append ".$mydomain" to addresses
95 without ".domain".
96
98 When a mail address localpart contains the optional recipient delimiter
99 (e.g., user+foo@domain), the lookup order becomes: user+foo@domain,
100 user@domain, user+foo, user, and @domain.
101
102 The propagate_unmatched_extensions parameter controls whether an
103 unmatched address extension (+foo) is propagated to the result of table
104 lookup.
105
107 This section describes how the table lookups change when the table is
108 given in the form of regular expressions. For a description of regular
109 expression lookup table syntax, see regexp_table(5) or pcre_table(5).
110
111 Each pattern is a regular expression that is applied to the entire
112 address being looked up. Thus, user@domain mail addresses are not bro‐
113 ken up into their user and @domain constituent parts, nor is user+foo
114 broken up into user and foo.
115
116 Patterns are applied in the order as specified in the table, until a
117 pattern is found that matches the search string.
118
119 Results are the same as with indexed file lookups, with the additional
120 feature that parenthesized substrings from the pattern can be interpo‐
121 lated as $1, $2 and so on.
122
124 This section describes how the table lookups change when lookups are
125 directed to a TCP-based server. For a description of the TCP
126 client/server lookup protocol, see tcp_table(5). This feature is not
127 available up to and including Postfix version 2.4.
128
129 Each lookup operation uses the entire address once. Thus, user@domain
130 mail addresses are not broken up into their user and @domain con‐
131 stituent parts, nor is user+foo broken up into user and foo.
132
133 Results are the same as with indexed file lookups.
134
136 The following shows a generic mapping with an indexed file. When mail
137 is sent to a remote host via SMTP, this replaces his@localdomain.local
138 by his ISP mail address, replaces her@localdomain.local by her ISP mail
139 address, and replaces other local addresses by his ISP account, with an
140 address extension of +local (this example assumes that the ISP supports
141 "+" style address extensions).
142
143 /etc/postfix/main.cf:
144 smtp_generic_maps = hash:/etc/postfix/generic
145
146 /etc/postfix/generic:
147 his@localdomain.local hisaccount@hisisp.example
148 her@localdomain.local heraccount@herisp.example
149 @localdomain.local hisaccount+local@hisisp.example
150
151 Execute the command "postmap /etc/postfix/generic" whenever the table
152 is changed. Instead of hash, some systems use dbm database files. To
153 find out what tables your system supports use the command "postconf
154 -m".
155
157 The table format does not understand quoting conventions.
158
160 The following main.cf parameters are especially relevant. The text
161 below provides only a parameter summary. See postconf(5) for more
162 details including examples.
163
164 smtp_generic_maps
165 Address mapping lookup table for envelope and header sender and
166 recipient addresses while delivering mail via SMTP.
167
168 propagate_unmatched_extensions
169 A list of address rewriting or forwarding mechanisms that propa‐
170 gate an address extension from the original address to the
171 result. Specify zero or more of canonical, virtual, alias, for‐
172 ward, include, or generic.
173
174 Other parameters of interest:
175
176 inet_interfaces
177 The network interface addresses that this system receives mail
178 on. You need to stop and start Postfix when this parameter
179 changes.
180
181 proxy_interfaces
182 Other interfaces that this machine receives mail on by way of a
183 proxy agent or network address translator.
184
185 mydestination
186 List of domains that this mail system considers local.
187
188 myorigin
189 The domain that is appended to locally-posted mail.
190
191 owner_request_special
192 Give special treatment to owner-xxx and xxx-request addresses.
193
195 postmap(1), Postfix lookup table manager
196 postconf(5), configuration parameters
197 smtp(8), Postfix SMTP client
198
200 Use "postconf readme_directory" or "postconf html_directory" to locate
201 this information.
202 ADDRESS_REWRITING_README, address rewriting guide
203 DATABASE_README, Postfix lookup table overview
204 STANDARD_CONFIGURATION_README, configuration examples
205
207 The Secure Mailer license must be distributed with this software.
208
210 A genericstable feature appears in the Sendmail MTA.
211
212 This feature is available in Postfix 2.2 and later.
213
215 Wietse Venema
216 IBM T.J. Watson Research
217 P.O. Box 704
218 Yorktown Heights, NY 10598, USA
219
220
221
222 GENERIC(5)