Cool postfix tips

From Mike A. Leonetti

Jump to: navigation, search

Getting detailed information about a message in the queue with postcat

If somebody is spamming out on your server if you just want to know what's inside of a message stuck in the queue you can use postcat. For more information reference

postcat will give you very detailed information about the message in the queue, including where it came from, and even the user that was authenticated at the time of send. It also includes the message itself and all headers. It's an excellent tool for seeing what kind of messages are getting stuck in your queue.

Simple use the command:

postcat -q [message-id]

Just to warn you, the output will be very large. So possibly piping it to less may be better for you.

The message ID can be found in either the postfix mail log OR by browsing:

postqueue -p

You can pipe postqueue's output to less or possibly grep to weed out one entry like the sender. That will give you the message-id.

Deleting all messages in the queue from a specific sender address with postsuper

Recently I've had spam build up in the queue from a user sending out through When searching online I see that this is a popular spam address.

Luckily, all of the spam messages on the server were from that address. So using postsuper and postqueue (with some awk) I was able to remove all messages. For more information on postsuper see

This command found all messages by and deleted them out.

postqueue -p | grep | awk '{print $1}' | postsuper -d -

postsuper -d will accept a message-id OR with a hyphen (-) it will read from the stdin. This was perfect for my use.

Personal tools
Google AdSense