Understanding main.cf

How Postfix parameters are declared, queried, overridden, and validated.

v2.4Updated 2026-07-20Production guidance
Production note: Back up configuration, run postfix check, and stage changes before reloading.

Configuration model

main.cf contains service-wide parameters. Use postconf to query effective values instead of reading only the file.

Essential commands

postconf -n
postconf -d relayhost
postconf -h myhostname
postconf -e "smtp_tls_security_level = may"
postfix check

Precedence and expansion

Parameters may reference other parameters with $name. Avoid circular references and quote shell input correctly when using postconf -e.

Safe change workflow

  1. Back up files.
  2. Change one logical unit.
  3. Run postfix check.
  4. Reload, not restart, when possible.
  5. Verify logs and queue behavior.
Search Trushilla Documentation