Viewing the Mail Queue
Postfix maintains a queue of messages waiting to be delivered. Understanding queue management helps troubleshoot delivery issues.
# Show queued messages
postqueue -p
# Count messages in queue
postqueue -p | tail -n 1
# Detailed queue summary
qshape deferredQueue Directories
| Directory | Purpose |
|---|---|
| incoming | Newly received messages |
| active | Currently being delivered |
| deferred | Temporarily failed, will retry |
| hold | Manually held messages |
| corrupt | Damaged queue files |
Flushing the Queue
# Retry all deferred messages immediately
postqueue -f
# Retry a specific message
postqueue -i QUEUE_ID
# Flush messages for a specific domain
postqueue -s example.comDeleting Messages
# Delete a specific message
postsuper -d QUEUE_ID
# Delete ALL queued messages (use with caution)
postsuper -d ALL
# Delete only deferred messages
postsuper -d ALL deferredHolding and Releasing
# Put a message on hold
postsuper -h QUEUE_ID
# Release a held message
postsuper -H QUEUE_ID
# Hold all messages
postsuper -h ALLInspecting a Message
# View message headers and envelope
postcat -q QUEUE_ID
# View full message content
postcat -bh QUEUE_IDCommon Troubleshooting
If the deferred queue grows large, check /var/log/mail.log for recurring errors. Common causes include DNS resolution failures, remote server rejections, and network connectivity issues.