Earlier today we had a minor issue on a development server that generated around 175,000 emails dumped into a Postfix queue in a short amount of time. I needed to first analyze the emails and second clear the Postfix queue. Below is information on how to learn more about the emails in the Postfix queue, what domain they are being sent to, and last but not least delete those emails from the queue if they are not needed.

Analyze Postfix Queue Using qshape:

First thing I would recommend doing is seeing how many active emails are in the Postfix queue and what domain they are going to.

[root@dev log]# qshape active
                                   T  5 10  20 40  80  160   320  640 1280 1280+
                         TOTAL 19997  1 16 133 85 580 4364 10160 3117 1099   442
                 example.com 19997  1 16 133 85 580 4364 10160 3117 1099   442

As you can see above there are around 20,000 emails stuck in the active queue. Outside of the above there were 150,000+ other emails also stuck in the Postfix queue.

Remove Email From Postfix Queue Using postsuper:

[root@dev log]# postsuper -d ALL
postsuper: Deleted: 177688 messages

Again make sure that these emails are not required for any reason and then the above command can be used to clear the entire queue. You might also want to restart postfix right after clearing the queue.

Verify Postfix Active Queue Is Clear Using qshape:

[root@dev log]# qshape active
                                         T  5 10 20 40 80 160 320 640 1280 1280+
                                  TOTAL 15 15  0  0  0  0   0   0   0    0     0
                     halomonitoring.com 15 15  0  0  0  0   0   0   0    0     0

The Book of Postfix: State-of-the-Art Message Transport (Paperback)

By (author): Ralf Hildebrandt, Patrick Koetter


List Price: $44.95 USD
New From: $195.22 USD In Stock
Used from: $38.23 USD In Stock

Postfix: The Definitive Guide (Paperback)

By (author): Kyle D. Dent


List Price: $39.99 USD
New From: $22.90 USD In Stock
Used from: $6.74 USD In Stock

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , , ,
Leave a Reply

*Type the letter/number combination in the abvoe field before clicking submit.

*