Remove spam from the Postfix queue in Ubuntu

By | September 4, 2017

Remove spam from the Postfix queue in Ubuntu, delete all MAILER-DAEMON emails in Postfix queue,Quickly clear Postfix’s mail queue,Empty Postfix Mail Queue


Remove spam from the Postfix queue in Ubuntu

There is nothing better than waking up a quiet Saturday and finding that your hosting provider has blocked you from port 25 because your server is sending spam.

Nothing, to the keyboard.

We access as root and we list the mail queue with the command mailq , since we use Postfix . I find that the queue is full of emails sent from an account that does not exist in a domain that is hosted on the server.

I delete the messages with the following command, which only deletes the messages that they have as from or to a Fictitious account, of course

postqueue -p | tail -n +2 | awk 'BEGIN {RS = ""} / jordi @ domaininfected \ .com / {print $ 1}' | tr-d '*! | postsuper -d -

I again list the queue with mailq after two seconds and I see that spam messages from that address reappear. As expected, the script that generates them is active.


Fetch unread gmail emails using PHP

Stop service Apache with service stop apache , again launch the delete command message and the mail queue again to list the queue with mailq .

Bingo, now the queue is clean. The responsible for not being able to enjoy the solecito this Saturday is a web script.

Leave a Reply

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