POSTMAP(1)
β¨ postmap(1) β Postfix lookup table management β¨
okay bestie so this is postmap, from the General Commands Manual section, and it is honestly one of those tools that looks scary and then turns out to be your little database-building bestie π«Ά. Sit with me, we're doing this together.
πΈ SYNOPSIS πΈ
postmap [-bfFhijmnNoprsuUvw] [-c config_dir] [-d key] [-q key]
[file_type:]file_name ...
π DESCRIPTION π
The postmap(1) command creates or queries one or more Postfix lookup tables, or updates an existing one. Three jobs, one icon π
If the result files do not exist, they get created with the same group and other read permissions as their source file. So like, it's not out here making up random perms, it's matching the vibe of the file you gave it π
While the table update is in progress, signal delivery is postponed, and an exclusive, advisory, lock is placed on the entire table, so spectator processes don't get jumpscared by a half-written table. No half-baked reveals, periodt.
π¦ INPUT FILE FORMAT π¦
The format of a lookup table input file goes like this:
- A table entry has the form
key whitespace value
- Empty lines and whitespace-only lines are ignored, and so are lines whose first non-whitespace character is a
#. (Comments, we love her π) - A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line.
The key and value are processed as is, except that surrounding white space is stripped off. Whitespace in lookup keys is supported in Postfix 3.2 and later, by surrounding the key with double quote characters ". Within the double quotes, double quote " and backslash \ characters can be included by quoting them with a preceding backslash.
When the -F option is given, the value must specify one or more filenames separated by comma and/or whitespace; postmap(1) will concatenate the file content (with a newline character inserted between files) and will store the base64-encoded result instead of the value. Glow-up via encoding π«
When the key specifies email address information, the localpart should be enclosed with double quotes if required by RFC 5322. For example, an address localpart that contains ;, or a localpart that starts or ends with ..
By default the lookup key is mapped to lowercase to make the lookups case insensitive; as of Postfix 2.3 this case folding happens only with tables whose lookup keys are fixed-case strings such as btree:, dbm: or hash:. With earlier versions, the lookup key is folded even with tables where a lookup field can match both upper and lower case text, such as regexp: and pcre:. This resulted in loss of information with $number substitutions. π rip to that information, gone but not forgotten
π COMMAND-LINE ARGUMENTS π
-bβ Enable message body query mode. When reading lookup keys from standard input with"-q -", process the input as if it is an email message in RFC 5322 format. Each line of body content becomes one lookup key.
By default, the -b option starts generating lookup keys at the first non-header line, and stops when the end of the message is reached. To simulate body_checks(5) processing, enable MIME parsing with -m. With this, the -b option generates no body-style lookup keys for attachment MIME headers and for attached message/* headers.
NOTE: with"smtputf8_enable = yes", the-boption disables UTF-8 syntax checks on query keys and lookup results. Specify the-Uoption to force UTF-8 syntax checks anyway.
This feature is available in Postfix version 2.6 and later.
-c config_dirβ Read themain.cfconfiguration file in the named directory instead of the default configuration directory.-d keyβ Search the specified maps for key and remove one entry per map. The exit status is zero when the requested information was found.
If a key value of - is specified, the program reads key values from the standard input stream. The exit status is zero when at least one of the requested keys was found.
-fβ Do not fold the lookup key to lower case while creating or querying a table.
With Postfix version 2.3 and later, this option has no effect for regular expression tables. There, case folding is controlled by appending a flag to a pattern.
-Fβ When querying a map, or listing a map, base64-decode each value. When creating a map from source file, process each value as a list of filenames, concatenate the content of those files, and store the base64-encoded result instead of the value (see INPUT FILE FORMAT for details). π«
This feature is available in Postfix version 3.4 and later.
-hβ Enable message header query mode. When reading lookup keys from standard input with"-q -", process the input as if it is an email message in RFC 5322 format. Each logical header line becomes one lookup key. A multi-line header becomes one lookup key with one or more embedded newline characters.
By default, the -h option generates lookup keys until the first non-header line is reached. To simulate header_checks(5) processing, enable MIME parsing with -m. With this, the -h option also generates header-style lookup keys for attachment MIME headers and for attached message/* headers.
NOTE: with"smtputf8_enable = yes", the-hoption option disables UTF-8 syntax checks on query keys and lookup results. Specify the-Uoption to force UTF-8 syntax checks anyway.
This feature is available in Postfix version 2.6 and later.
-iβ Incremental mode. Read entries from standard input and do not truncate an existing database. By default,postmap(1)creates a new database from the entries in file_name.-jβ JSON output. Format the output from-qand-sas one{"key": "value"}object per line. β¨ very demure, very parseable β¨
This feature is available in Postfix version 3.11 and later.
-mβ Enable MIME parsing with"-b"and"-h".
This feature is available in Postfix version 2.6 and later.
-Nβ Include the terminating null character that terminates lookup keys and values. By default,postmap(1)does whatever is the default for the host operating system. (Your OS decides, not us π«Ά)-nβ Don't include the terminating null character that terminates lookup keys and values. By default,postmap(1)does whatever is the default for the host operating system.-oβ Do not release root privileges when processing a non-root input file. By default,postmap(1)drops root privileges and runs as the source file owner instead. Safety first bestie π-pβ Do not inherit the file access permissions from the input file when creating a new file. Instead, create a new file with default access permissions (mode0644).-q keyβ Search the specified maps for key and write the first value found to the standard output stream. The exit status is zero when the requested information was found.
Note: this performs a single query with the key as specified, and does not make iterative queries with substrings of the key as described for access(5), canonical(5), transport(5), virtual(5) and other Postfix table-driven features.
If a key value of - is specified, the program reads key values from the standard input stream and writes one line of key value output for each key that was found. The exit status is zero when at least one of the requested keys was found.
-rβ When updating a table, do not complain about attempts to update existing entries, and make those updates anyway.-sβ Retrieve all database elements, and write one line of key value output for each element. The elements are printed in database order, which is not necessarily the same as the original input order. (She has her own order, respect it π)
This feature is available in Postfix version 2.2 and later, and is not available for all database types.
-uβ Disable UTF-8 support. UTF-8 support is enabled by default when"smtputf8_enable = yes". It requires that keys and values are valid UTF-8 strings.-Uβ With"smtputf8_enable = yes", force UTF-8 syntax checks with the-band-hoptions.-vβ Enable verbose logging for debugging purposes. Multiple-voptions make the software increasingly verbose. Stack them, go feral π₯-wβ When updating a table, do not complain about attempts to update existing entries, and ignore those attempts.
π Arguments π
- file_type β The database type. To find out what types are supported, use the
"postconf -m"command.
When no file_type is specified, the software uses the database type specified via the default_database_type configuration parameter. The default value for this parameter depends on the host environment.
The postmap(1) command can query any supported file type, but it can create only the following file types:
btreeβ The output file is a btree file, namedfile_name.db. This is available on systems with support fordbdatabases.cdbβ The output consists of one file, namedfile_name.cdb. This is available on systems with support forcdbdatabases.dbmβ The output consists of two files, namedfile_name.pagandfile_name.dir. This is available on systems with support fordbmdatabases.failβ A table that reliably fails all requests. The lookup table name is used for logging only. This table exists to simplify Postfix error tests. (a hater, but a consistent one π)hashβ The output file is a hashed file, namedfile_name.db. This is available on systems with support fordbdatabases.lmdbβ The output is a btree-based file, namedfile_name.lmdb.lmdbsupports concurrent writes and reads from different processes, unlike other supported file-based tables. This is available on systems with support forlmdbdatabases. πsdbmβ The output consists of two files, namedfile_name.pagandfile_name.dir. This is available on systems with support forsdbmdatabases.
- file_name β The name of the lookup table source file when rebuilding a database.
π©Ί DIAGNOSTICS π©Ί
Problems are logged to the standard error stream and to syslogd(8) or postlogd(8). No output means that no problems were detected. Duplicate entries are skipped and are flagged with a warning.
postmap(1) terminates with zero exit status in case of success (including successful "postmap -q" lookup) and terminates with non-zero exit status in case of failure.
π± ENVIRONMENT π±
MAIL_CONFIGβ Directory with Postfix configuration files.MAIL_VERBOSEβ Enable verbose logging for debugging purposes.
βοΈ CONFIGURATION PARAMETERS βοΈ
okay bestie so these are the main.cf parameters that are especially relevant to this program π. Heads up tho: what's down below is just a parameter summary, like a lil trailer, not the whole movie. Go read postconf(5) if you want the full deets, examples included, fr fr.
berkeley_db_create_buffer_size(16777216) β the per-table I/O buffer size for programs that create Berkeley DB hash or btree tables. it's giving "room to grow" energy.berkeley_db_read_buffer_size(131072) β the per-table I/O buffer size for programs that read Berkeley DB hash or btree tables. just here to look, not create β¨config_directory(seepostconf -doutput) β where the Postfixmain.cfandmaster.cfconfig files live by default. their home address basically πdefault_database_type(seepostconf -doutput) β the default database type used innewaliases(1),postalias(1)andpostmap(1)commands. the "if you don't say, we pick for you" of it all πimport_environment(seepostconf -doutput) β the list of environment variables that a privileged Postfix process will import from a non-Postfix parent process, orname=valueenvironment overrides. yes she's picky about who she lets in, and honestly? valid.smtputf8_enable(yes) β turn on the preliminary SMTPUTF8 support for the protocols described in RFC 6531, RFC 6532, and RFC 6533. unicode girlies rise πsyslog_facility(mail) β the syslog facility of Postfix logging. that's the vibe of where the logs get filed.syslog_name(seepostconf -doutput) β a prefix that gets prepended to the process name in syslog records, so like,"smtpd"becomes"prefix/smtpd". a lil name tag for your logs π
Available in Postfix 2.11 and later:
lmdb_map_size(16777216) β the initial OpenLDAP LMDB database size limit, in bytes. started from the bottom, now we're here β
π SEE ALSO π
the friend group, the mutuals, the you might also like section:
postalias(1)β create/update/query alias databasepostconf(1)β supported database typespostconf(5)β configuration parameterspostlogd(8)β Postfix loggingsyslogd(8)β system logging
π README FILES π
bestie if you're wondering where this info actually lives, run "postconf readme_directory" or "postconf html_directory" to locate it πΊοΈ no cap, that's the move.
DATABASE_READMEβ Postfix lookup table overview
π LICENSE π
The Secure Mailer license must be distributed with this software. like, must. it's not optional, it's not a suggestion, it's the rules π
π AUTHOR(S) π
the icons themselves, the legends who made this:
- 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
and that's the whole page bestie π«Ά this was POSTMAP(1) β you've officially made it to the end, iconic behavior πβ¨ go forth and rebuild those lookup tables, and remember: same page, same facts, just a lil more sparkle π
π πΈ π¦
(that footer you see down there is just the source/version + date tag, the standard "this is where it came from and when" situation β you know the drill π)
π¦ 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