Release hold queue email in Postfix – postsuper

Reading Time: 2 Minutes

How to flush Postfix’ mail queue from the command line? Easy, use the Postfix postsuper command as explained in this post. The postsuper command controls different types of queues in the Postfix mail system, like the deferred or hold queue. This post shows you some Postfix queue operations to maintain your mail servers.

Postfix superintendent postsuper command does maintenance jobs on the Postfix queue. Use of the command is restricted to the superuser. The following commands releases or deletes mail:

To see the Postfix mail queue, enter:

# mailq

To remove all mail from the queue:

# postsuper -d ALL

To remove all mails in the deferred queue:

# postsuper -d ALL deferred

Remove all mails in the hold queue:

# postsuper -d ALL hold

You can use -H to release an email that was put “on hold” in Postfix’ queues. Release an email by its queue-id:

# postsuper -H <queue_id>

Or release all hold mails from the hold queue;

# postsuper -H ALL

Are you running multiple Postfix mail instances? Use postmulti, the multi-instance manager:

postmulti -i <instance> -x mailq
postmulti -i <instance> -x postsuper -d ALL
postmulti -i <instance> -x postsuper -d ALL deferred
postmulti -i <instance> -x postsuper -d ALL hold

Everything can be put together in a Bash management script. One example is to delete all MAILER-DAEMON mails from the queue in Postfix.

Interesting:   Remove Jetpack email sharing service

How to flush postfix mail queue and its various operations.

Hi! Join the discussion, leave a reply!