How Do You Cancel a Postfix Mail Queue?

Problem scneario
You use the mailq command. You see several emails have timed out. These emails are essentially in an "outbox" and a future delivery attempt is in the near future. How do you cancel the sending of these emails?

Solution
If you use the mailq command, each email will have a queue ID. It will be an alphanumeric value on the left hand column. To delete an email, first find its queue ID with the mailq command. Then issue this command constructed as such:

postsuper -d

Example:

sudo postsuper -d A971545854

To delete every message in the mail queue, run this:

sudo postsuper -d ALL

Leave a comment

Your email address will not be published. Required fields are marked *