This skill should be used when the user asks about "Postfix configuration", "mail queue", "content filter", "mail routing", "amavisd", "milter", "SMTP relay", "mail delivery", "MTA settings",...
Guide for configuring and troubleshooting mail flow in Zimbra, including Postfix integration, content filtering, and queue management.
Zimbra uses Postfix as its MTA (Mail Transfer Agent):
Internet โ Proxy (nginx) โ Postfix โ Content Filter โ Postfix โ Mailbox
โ
amavisd-new
โ
SpamAssassin/ClamAV
| File | Purpose |
|---|---|
/opt/zimbra/common/conf/main.cf |
Main Postfix config |
/opt/zimbra/common/conf/master.cf |
Service definitions |
/opt/zimbra/conf/zmconfigd/smtpd.cf |
SMTP daemon config |
# View current setting
postconf content_filter
# View all settings
postconf -n
# Modify setting (as zimbra user)
zmprov ms $(hostname) zimbraMtaContentFilter "smtp-amavis:[127.0.0.1]:10024"
# Direct postconf (may be overwritten by Zimbra)
postconf -e "content_filter = smtp-amavis:[127.0.0.1]:10024"
# Reload after changes
postfix reload
# Content filter
zmprov ms mail.domain.com zimbraMtaContentFilter "smtp-amavis:[127.0.0.1]:10024"
# Relay host
zmprov ms mail.domain.com zimbraMtaRelayHost "smtp.relay.com:25"
# Message size limit (bytes)
zmprov ms mail.domain.com zimbraMtaMaxMessageSize 52428800
# SMTP authentication
zmprov ms mail.domain.com zimbraMtaSaslAuthEnable TRUE
To add a custom content filter (e.g., policy server):
# Check port availability FIRST
netstat -tlnp | grep 2525
# Add service to master.cf
postconf -Me "policy-filter/unix = policy-filter unix - n n - 10 smtp -o smtp_send_xforward_command=yes"
# Set content filter
zmprov ms $(hostname) zimbraMtaContentFilter "smtp:[127.0.0.1]:2525"
# Reload MTA
zmcontrol restart mta
For specific senders/recipients:
# Create transport map
echo "admin@domain.com :" >> /opt/zimbra/conf/transport
# Rebuild and reload
postmap /opt/zimbra/conf/transport
postfix reload
# Queue summary
mailq
# Detailed queue listing
postqueue -p
# Count messages
mailq | tail -n 1
# Flush queue (attempt redelivery)
postqueue -f
# Delete specific message
postsuper -d <queue-id>
# Delete all queued messages
postsuper -d ALL
# Hold message
postsuper -h <queue-id>
# Release held message
postsuper -H <queue-id>
# Requeue message
postsuper -r <queue-id>
# Find message in queue
find /opt/zimbra/data/postfix/spool -name "<queue-id>"
# View message headers
postcat -q <queue-id> | head -50
# View full message
postcat -q <queue-id>
# Service status
zmmtactl status
# Postfix status
postfix status
# Check listening ports
netstat -tlnp | grep -E "(25|465|587|10024|10025)"
# Main mail log
tail -f /var/log/zimbra.log
# Postfix log
tail -f /opt/zimbra/log/zimbra.log | grep postfix
# Track message by ID
grep <message-id> /var/log/zimbra.log
# Check queue reason
postqueue -p | grep -A 2 <queue-id>
# Check DNS
host -t mx recipient-domain.com
# Check relay connectivity
telnet relay.host.com 25
# Verify amavisd running
zmamavisdctl status
# Check content_filter setting
postconf content_filter
# Verify ports
netstat -tlnp | grep 10024
netstat -tlnp | grep 10025
# Check SASL config
postconf smtpd_sasl_auth_enable
# Test auth
openssl s_client -connect mail.domain.com:465 -quiet
AUTH LOGIN
# Set relay host
zmprov ms $(hostname) zimbraMtaRelayHost "smtp.relay.com:25"
# With authentication
zmprov ms $(hostname) zimbraMtaRelayHost "[smtp.relay.com]:587"
zmprov ms $(hostname) zimbraMtaSaslAuthEnable TRUE
# Configure credentials in sasl_passwd
echo "[smtp.relay.com]:587 username:password" >> /opt/zimbra/conf/sasl_passwd
postmap /opt/zimbra/conf/sasl_passwd
# Add to mynetworks
zmprov ms $(hostname) +zimbraMtaMyNetworks "192.168.1.0/24"
# Reload
postfix reload
# Check status
zmcbpolicydctl status
# View policies
sqlite3 /opt/zimbra/data/cbpolicyd/db/cbpolicyd.sqlitedb \
"SELECT * FROM policies;"
# Common rate limit (via admin console or direct SQL)
# Limit 100 messages per hour per sender
references/postfix-settings.md - Complete Postfix parameter referencereferences/amavisd-config.md - amavisd configuration optionsexamples/custom-content-filter.sh - Setup custom filterexamples/transport-map.sh - Configure transport routing