Postfix: Manipulating the Mail Queue
Submitted by LJ McDonald on 13 August 2013 - 2:45am
The Postfix Mail Transfer Agent (MTA) is a widely used MTA, especially on Linux systems. When testing, or doing maintenance on systems running postfix, you may need to see what messages are in the queue, and/or manipulate the queues.
To see messages in the mail queue, use the following command (this is the same as for sendmail):
mailq
To cause postfix to process the mail queue immediately:
postfix flush
To remove a specific message from the mail queue:
postsuper -d <queue id>
where <queue id> is the identifier of the message (as shown by 'mailq').
Postfix has four mail queues:
- maildrop - locally generated mail.
- incoming - externally arriving mail and processed mail from the maildrop queue.
- active - mail currently being delivered (locally or externally).
- deferred - mail that could not be delivered. Postfix periodically attempts to redeliver this mail.
To remove all messages from all mail queues, use the special identifier 'ALL':
postsuper -d ALL
To remove all messages from a specific mail queue, add the queue name:
postsuper -d ALL deferred