Postfix’s email queue

1- Postfix maintains two queues, the pending mails queue, and the deferred mail queue,
the differed mail queue has the mail that has soft-fail and should be retried (Temporary failure),
Postfix retries the deferred queue on set intervals (configurable, and by default 5 minutes)

In any case, the following commands should be useful

1- Display a list of queued mail, deferred and pending

or

To save the output to a text file you can run

or

the above commands display all queued messages (Not the message itself but the sender and recipients and ID), The ID is particularly useful if you want to inspect the message itself.

2- View message (contents, header and body) in Postfix queue

Assuming the message has the ID XXXXXXX (you can see the ID form the QUEUE)

Or to save it in a file

3- Tell Postfix to process the Queue now

OR

4- Delete queued mail

Delete all queued mail

Delete differed mail queue messages

(The ones the system intends to retry later)

Delete from queue selectively

To delete from the queue all emails that have a certain address in them, we can use this program (perl script)…

NOTE: This perl script seems to be free, and is all over the internet, i could not find out where it originates or who wrote it.

1- Download this file, unzip, and upload the file to your server, then from your bash command line, Change Directory to wherever you uploaded this file, for example cd /root (Just an example, You can upload it wherever you wish)

NOTE: A second script here works differently, i have not yet tested it, download it here

Now, from within that directory, execute…

Any mail that has this email address in it’s IN or OUT list will be deleted

 

Resource: http://www.tech-g.com/2012/07/15/inspecting-postfixs-email-queue/

Leave a Reply

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