Skip to main content


Postfix Message Queue: Delete messages from a specific sender and to a specific recipient

I arrived this morning to a Postfix mail queue with more than 14,000 messages queued up. After inspecting the queue with

postqueue -p

I found that most of the messages were from a single spammer to a specific user. In order to clear the queue of these spam messages, I found the following bash script to delete all messages from a single sender to a single user: