LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

postmap

Create and query Postfix lookup tables

TLDR

Create hash database from text file
$ postmap [/etc/postfix/virtual]
copy
Create database with specific type
$ postmap hash:[/etc/postfix/transport]
copy
Query database
$ postmap -q [key] [/etc/postfix/virtual]
copy
Show all entries
$ postmap -s [/etc/postfix/virtual]
copy

SYNOPSIS

postmap [options] [filetype:]name_

DESCRIPTION

postmap creates and queries Postfix lookup tables. It converts plain text files containing key-value pairs into indexed database formats (hash, btree, dbm) for efficient lookups by the Postfix mail system. Common uses include virtual alias maps, transport maps, and access control tables.After editing a text lookup file, postmap must be run to rebuild the corresponding .db file that Postfix actually reads. The query mode (-q) allows testing individual lookups, and the show mode (-s) displays all entries, both useful for verifying that mappings work as expected before applying them to live mail delivery.

PARAMETERS

-q key

Query for key.
-s
Show all entries.
-d key
Delete key.
-i
Incremental mode.
-N
Include the table name as part of a lookup key or value.
-w
Wait for locked files.

EXAMPLES

$ # Create virtual alias map
postmap /etc/postfix/virtual

# Create transport map
postmap hash:/etc/postfix/transport

# Query specific entry
postmap -q "user@example.com" /etc/postfix/virtual

# Show all mappings
postmap -s /etc/postfix/virtual

# Delete entry
postmap -d "olduser@example.com" /etc/postfix/virtual
copy

FILE FORMAT

$ # /etc/postfix/virtual
user@example.com    localuser
@example.com        catchall@other.com
copy

INSTALL

sudo apt install postfix
copy
sudo dnf install postfix
copy
sudo pacman -S postfix
copy
sudo apk add postfix
copy
sudo zypper install postfix
copy
nix profile install nixpkgs#postfix
copy

CAVEATS

Run postmap after editing text files. Postfix reads .db file, not text. Use postmap -q to verify.

HISTORY

postmap is part of Postfix, the mail transfer agent created by Wietse Venema as a secure alternative to Sendmail.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid