A Web.com Partner

Fixing a large mail queue with Exim

Fixing a large mail queue with Exim

If your server has got a huge mail queue and you are unable to delete your email queue from your WHM/Cpanel then you can use the command line interface or SSH to delete your email queue.

/var/spool/mail/root is the place from were you can remove the mails,
if you want to remove mails of root, you can delete them from here /var/spool/mail/root
OR if you want to to remove the mails of a user then go /var/spool/mail/username

If you want to remove the mails from the exim then follow the following commands

exim -bp

Through this above command you will get some IDs like:

exim -bp 12d 3.0K 1Qe0j7-0004Fa-5x [email protected]

After above command use below command to delete that specific message

exim -Mrm {message-id}

Remove all emails from exim queue, this will delete every thing in your exim mail queue

# exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash

If you want to delete frozen messages, you may try below given commands

exiqgrep -z -i | xargs exim -Mrm

Alternate command to delete frozen mails

exim -bp | awk ‘$6 == “frozen” {print $3}’ | xargs exim -Mrm

You can check number of frozen email through below given command

exim -bp | grep frozen | wc -l
Both these below command also have the ability to delete the whole email queue
exim -bpru|awk {‘print $3?}|xargs exim -Mrm

If that command will not work, you may try

exim -bp | grep < | awk ‘{print $3}’ | xargs exim -Mrm
x