bsd@conqueror.pro avatar

Postfix queue cheat sheet

nmd

Published: 22 Dec 2017 › Updated: 22 Dec 2017Postfix queue cheat sheet

Postfix queue cheat sheet

This is the shortest cheat sheet for those who just started working with Postfix and needs to do something with the mail queue.

Postfix maintains two queues, the pending mail queue and the deferred mail queue. The deferred mail queue has the mail that has soft-fail and should be retried (temporary failure). Postfix retries the deferred queue on set intervals (default = 5 minutes).

Below are the most used commands to manipulate the queue:

Display a list of mail queues, deferred and pending

mailq

or

postqueue -p

View a message (contents, headers and body) with a specific ID

postcat -vq <ID>

<id> ::= XXXXXXXX, e.g. 2B2D742031

Flush the queue (tell Postfix to process all mails now)

postqueue -f

Delete all queued mails

postsuper -d ALL

Delete all deferred mails

postsuper -d all deferred

Delete mails selectively (delete if recipient = email@address.com)

mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "email@address.com" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -

Leave Postfix queue cheat sheet to:

Written by

Read more #postfix posts


Best Posts From bsd@conqueror.pro

We have not curated any of nmd's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From bsd@conqueror.pro