1GENERIC(5)                    File Formats Manual                   GENERIC(5)
2
3
4

NAME

6       generic - Postfix generic table format
7

SYNOPSIS

9       postmap /etc/postfix/generic
10
11       postmap -q "string" /etc/postfix/generic
12
13       postmap -q - /etc/postfix/generic <inputfile
14

DESCRIPTION

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  ad‐
24       dresses  when mail has to be sent across the Internet.  See the EXAMPLE
25       section at the end of this document.
26
27       The generic(5) mapping affects both message header addresses (i.e.  ad‐
28       dresses  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  di‐
42       rected to a TCP-based server. In those cases, the lookups are done in a
43       slightly different way as described below under "REGULAR EXPRESSION TA‐
44       BLES" or "TCP-BASED TABLES".
45

CASE FOLDING

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

TABLE FORMAT

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

TABLE SEARCH ORDER

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  se‐
70       quence 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

RESULT ADDRESS REWRITING

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

ADDRESS EXTENSION

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 un‐
106       matched address extension (+foo) is propagated to the result  of  table
107       lookup.
108

REGULAR EXPRESSION TABLES

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 ad‐
115       dress being looked up. Thus, user@domain mail addresses are not  broken
116       up  into their user and @domain constituent parts, nor is user+foo bro‐
117       ken 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

TCP-BASED TABLES

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
130       available in Postfix 2.5 and later.
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

EXAMPLE

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

BUGS

160       The table format does not understand quoting conventions.
161

CONFIGURATION PARAMETERS

163       The following main.cf parameters are especially relevant.  The text be‐
164       low provides only a parameter summary. See postconf(5) for more details
165       including examples.
166
167       smtp_generic_maps (empty)
168              Optional lookup tables that perform  address  rewriting  in  the
169              Postfix  SMTP client, typically to transform a locally valid ad‐
170              dress into a globally valid address when sending mail across the
171              Internet.
172
173       propagate_unmatched_extensions (canonical, virtual)
174              What  address  lookup  tables copy an address extension from the
175              lookup key to the lookup result.
176
177       Other parameters of interest:
178
179       inet_interfaces (all)
180              The network interface addresses that this mail  system  receives
181              mail on.
182
183       proxy_interfaces (empty)
184              The  network  interface addresses that this mail system receives
185              mail on by way of a proxy or network address translation unit.
186
187       mydestination ($myhostname, localhost.$mydomain, localhost)
188              The list of domains that are delivered via the  $local_transport
189              mail delivery transport.
190
191       myorigin ($myhostname)
192              The  domain  name that locally-posted mail appears to come from,
193              and that locally posted mail is delivered to.
194
195       owner_request_special (yes)
196              Enable special  treatment  for  owner-listname  entries  in  the
197              aliases(5) file, and don't split owner-listname and listname-re‐
198              quest address localparts when the recipient_delimiter is set  to
199              "-".
200

SEE ALSO

202       postmap(1), Postfix lookup table manager
203       postconf(5), configuration parameters
204       smtp(8), Postfix SMTP client
205

README FILES

207       Use  "postconf readme_directory" or "postconf html_directory" to locate
208       this information.
209       ADDRESS_REWRITING_README, address rewriting guide
210       DATABASE_README, Postfix lookup table overview
211       STANDARD_CONFIGURATION_README, configuration examples
212

LICENSE

214       The Secure Mailer license must be distributed with this software.
215

HISTORY

217       A genericstable feature appears in the Sendmail MTA.
218
219       This feature is available in Postfix 2.2 and later.
220

AUTHOR(S)

222       Wietse Venema
223       IBM T.J. Watson Research
224       P.O. Box 704
225       Yorktown Heights, NY 10598, USA
226
227       Wietse Venema
228       Google, Inc.
229       111 8th Avenue
230       New York, NY 10011, USA
231
232
233
234                                                                    GENERIC(5)
Impressum