RELOCATED(5)
๐ RELOCATED(5) โ the Postfix relocated table format, but make it make sense ๐
okay bestie, gather round, because we're doing the relocated(5) page from the File Formats Manual and it's genuinely lowkey iconic. this is the table that tells the world "she's not here anymore, she MOVED" ๐ฆ
โจ NAME โจ
relocated โ Postfix relocated table format
๐ SYNOPSIS ๐
postmap /etc/postfix/relocated
๐ DESCRIPTION ๐
The optional relocated(5) table holds the info that gets used in "user has moved to new_location" bounce messages. that's the whole vibe. ๐ฌ
Normally, the relocated(5) table is specified as a text file that serves as input to the postmap(1) command, which then creates an indexed file so lookups are fast. speed demon behaviour fr fr โจ
Run this command to rebuild a default-type indexed file after you change the text file:
postmap /etc/postfix/relocated
or run this one if you want to specify an explicit type:
postmap type:/etc/postfix/relocated
The default indexed file type is configured with the default_database_type parameter. depending on your platform, that might be one of lmdb:, cdb:, hash:, or dbm: โ and heads up, no trailing ':' on those ๐
When the table is provided via other means like NIS, LDAP or SQL, the same lookups happen as for ordinary indexed files. But managing those databases? not Postfix's problem, that's outside the scope. ๐
Alternatively, the table can be provided as a regular-expression map where patterns are given as regular expressions, or lookups can be directed to a TCP-based server. In those cases the lookups are done in a slightly different way, and that's all spelled out below under "REGULAR EXPRESSION TABLES" or "TCP-BASED TABLES". okay so go read those sections, I'm not repeating myself ๐
Table lookups are case insensitive. โจ
๐ธ CASE FOLDING ๐ธ
The search string gets folded to lowercase before the database lookup. periodt.
BUT โ as of Postfix 2.3, the search string is not case folded with database types like regexp: or pcre:, because those lookup fields can match both upper and lower case. so if you're on regexp or pcre, casing is your problem now bestie ๐
๐ TABLE FORMAT ๐
- By default, Postfix will prepend a hard-coded prefix
"5.1.6 User has moved to "to a table lookup result, and the format for a table entry is as follows:
pattern new_location
Where new_location specifies contact information such as an email address, or perhaps a street address or telephone number. like, whatever you want them to reach out to ๐ฎ
- Postfix 3.11 and later can optionally disable that hard-coded prefix. Specify
relocated_prefix_enable = noinmain.cf, and then specifyrelocated_mapsentries with your own RFC 3463-compliant enhanced status code and text, for example:
pattern 5.1.6 Mailbox has moved to user@example
pattern 5.2.0 Mailbox is unavailable
pattern 5.2.1 Mailbox is disabled
you get to write your own status codes now, main character energy ๐
- Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a
#. those are the classic "not me, not today" lines ๐ - A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. so indentation = continuation, don't forget ๐ง
โญ TABLE SEARCH ORDER โญ
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 listed below:
user@domainโ Matchesuser@domain. This form has precedence over all other forms. it's the VIP of the group chat ๐userโ Matchesuser@sitewhen site is$myorigin, when site is listed in$mydestination, or when site is listed in$inet_interfacesor$proxy_interfaces.@domainโ Matches other addresses in domain. This form has the lowest precedence. last place, sorry babe ๐ฅฒ
๐ฆ ADDRESS EXTENSION ๐ฆ
When a mail address localpart contains the optional recipient delimiter (e.g., user+foo@domain), the lookup order becomes: user+foo@domain, user@domain, user+foo, user, and @domain.
that's the full chain, in that exact order, no skipping ๐ฅ
๐ REGULAR EXPRESSION TABLES ๐
This section describes how the table lookups change when the table is given in the form of regular expressions, or when lookups are directed to a TCP-based server. For a description of regular expression lookup table syntax, see regexp_table(5) or pcre_table(5). For a description of the TCP client/server table lookup protocol, see tcp_table(5). This feature is available in Postfix 2.5 and later.
Each pattern is a regular expression that is applied to the entire address being looked up. so user@domain mail addresses are not broken up into their user and @domain constituent parts, and user+foo is not broken up into user and foo. no splitting, no chopping, we respect the whole address ๐ซถ
Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string.
Results are the same as with indexed file lookups, with the additional feature that parenthesized substrings from the pattern can be interpolated as $1, $2 and so on. cute little placeholders, obsessed โจ
๐ TCP-BASED TABLES ๐
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 tcp_table(5). This feature is available in Postfix 2.5 and later.
Each lookup operation uses the entire address once. so again: user@domain mail addresses are not broken up into their user and @domain constituent parts, and user+foo is not broken up into user and foo. one address, one lookup, that's the rule ๐
Results are the same as with indexed file lookups.
๐ญ BUGS ๐ญ
The table format does not understand quoting conventions.
that's it. that's the bug. no fancy quotes, no escape tricks, it simply does not know her ๐
โจ CONFIGURATION PARAMETERS โจ
The following main.cf parameters are especially relevant. The text below provides only a parameter summary. See postconf(5) for more details including examples. (iykyk ๐)
relocated_maps(empty) โ Optional lookup tables with new contact information for users or domains that no longer exist.
Available with Postfix version 3.11 and later:
relocated_prefix_enable(yes) โ Prepend the prefix"5.1.6 User has moved to "to allrelocated_mapslookup results.
Other parameters of interest:
inet_interfaces(all) โ The local network interface addresses that this mail system receives mail on.mydestination($myhostname, localhost.$mydomain, localhost) โ The list of domains that are delivered via the$local_transportmail delivery transport.myorigin($myhostname) โ The domain name that locally-posted mail appears to come from, and that locally posted mail is delivered to.proxy_interfaces(empty) โ The remote network interface addresses that this mail system receives mail on by way of a proxy or network address translation unit.
๐ฅ SEE ALSO ๐ฅ
trivial-rewrite(8), address resolverpostmap(1), Postfix lookup table managerpostconf(5), configuration parameters
๐ README FILES ๐
Use "postconf readme_directory" or "postconf html_directory" to locate this information.
DATABASE_README, Postfix lookup table overviewADDRESS_REWRITING_README, address rewriting guide
๐ LICENSE ๐
The Secure Mailer license must be distributed with this software.
๐ AUTHOR(S) ๐
Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA
Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA
okay that's the whole page, bestie, we ate and left no crumbs ๐ โจ and to sign off cute: this whole thing lives in the File Formats Manual as RELOCATED(5), so if you ever forget where you found it, that's where, mwah ๐๐ฆ๐
๐ฆ where this page comes from
- alpine 3.24: postfix-doc 3.11.7-r0 ยท IPL-1.0 EPL-2.0
- arch rolling: postfix 3.11.7-1 ยท EPL-2.0 OR IPL-1.0 AND BSD-4-Clause-UC
- nixos 26.05: postfix 3.11.7
- nixpkgs unstable: postfix 3.11.7
- ubuntu stonking: postfix 3.11.7-1ubuntu2
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms