postmap
TLDR
Create hash database from text file
$ postmap [/etc/postfix/virtual]
Create database with specific type$ postmap hash:[/etc/postfix/transport]
Query database$ postmap -q [key] [/etc/postfix/virtual]
Show all entries$ postmap -s [/etc/postfix/virtual]
SYNOPSIS
postmap [options] [filetype:]name_
DESCRIPTION
postmap creates and queries Postfix lookup tables. It converts plain text files to indexed database format (hash, btree, etc.) for efficient lookups by the Postfix mail system.
PARAMETERS
-q key
Query for key.-s
Show all entries.-d key
Delete key.-i
Incremental mode.-N
Include newlines in values.-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
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
FILE FORMAT
$ # /etc/postfix/virtual
user@example.com localuser
@example.com catchall@other.com
user@example.com localuser
@example.com catchall@other.com
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.


