Commands Learned

Commands Learned

Capture CLI patterns discovered during implementation. Candidates for codex graduation after 3+ uses.

Postfix

# Show all non-default configuration
postconf -n

# Test address rewriting without sending
postmap -q "user@domain" hash:/etc/postfix/virtual

# View mail queue
mailq

# Flush deferred queue
postfix flush

# Delete all queued messages
postsuper -d ALL

# Trace a specific message
postcat -q <queue_id>

DKIM/DMARC

# Test DKIM key in DNS
opendkim-testkey -d <domain> -s <selector> -vvv

# View DKIM signature on a message
grep -i "dkim-signature" /path/to/message

# Check DMARC record
dig TXT _dmarc.<domain> +short

Mail Headers

# Extract Authentication-Results from a Maildir message
awk '/^Authentication-Results:/,/^[^ \t]/' ~/Maildir/new/<message>

# View full headers
head -100 ~/Maildir/new/<message>

# Count messages by SPF result
grep -rl "spf=fail" ~/Maildir/ | wc -l

Dovecot

# Test authentication
doveadm auth test <username>

# List mailboxes
doveadm mailbox list -u <username>

# Search messages
doveadm search -u <username> subject "test"

# Force mailbox sync
doveadm force-resync -u <username> INBOX