• Contact: +91-08069248012

Empty mail queue in exim


So you have a lot of mails in the mail queue, from f.e spam accounts?
First check how many mails are in the queue with the command:

# exim -bpc

With me it gives an output of 1680 mails, which is too much. 
If you have a lot of spam mails, it can go over 1000 mails in the queue.

Then you can give in this command to see the sender and receiver of the mails:

# exim -bp | less

I use the "| less" command, because if you have more than 1000 mails, you can check where most are coming from.
Let's say for example there are a lot of mails in there from info@secure-paypal.com.

This is the way to empty all mails from that specific address:

# grep -lr 'info@secure-paypal.com' /var/spool/exim/input/ | sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g' | xargs exim -Mrm

Now check the mail queue again with the command:

# exim -bpc

You should have less mails than before!