Delete Mail From Queue in Exim

Deleting email from the exim queue is unfortunately not that simple. If you have a massive spammer in your system, you can clear the email originating from them with the command below.
exim -bpru | tr '\n' + | sed -e "s/++/=/g" | tr -d + | tr = '\n' | grep "spammer@email.com" | awk {'print $3'} | xargs exim -Mrm
Simple replace the spammer@email.com address with the potential spammer.
Don’t forget that this command uses the whole queue list to process. Sometimes if you have hundreds of thousands of email from this spammer in queue, it will get hard to process them all for the system. So instead of using the whole queue list, we can break it down to pieces with the head command.

The command below will break it down to pieces of 5000, so if you have more than 5000, you should run this command several times.
exim -bpru | head -n 5000 | tr '\n' + | sed -e "s/++/=/g" | tr -d + | tr = '\n' | grep "spammer@email.com" | awk {'print $3'} | xargs exim -Mrm
To delete all mails from the queue, simply use this command.
exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | sh
  • 93 Los Usuarios han Encontrado Esto Útil
¿Fue útil la respuesta?

Artículos Relacionados

Fix Incoming Mail Delay With Postfix

In our case, we were using postfix via iRedMail and every incoming mail had a delay around 7...

How to Export Subscribers from a Cpanel Mailman List?

Cpanel’s Mailman is an open-source mailing list application. The problem is that there is...

Detecting Possible Mail Forgers in EXIM

The other day we were working on a mail server of a customer’s that spammed insanely. Since...

Push Email with Dovecot Mail Server

I have been looking a way to push e-mail since i got my iphone. Just found something for my test...