Remove all messages from exim queue

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

`exim -bp`, lists the messages in queue, which is piped through awk, printing to output "exim -Mrm {MessageID}" which is further piped into bash for execution.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cleanup all apache generated mails from exim mail queue

This works out better if you know the sender email address that needs weeding from the mail queue.

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

or if you need to clean mails older than a couple days from the queue:

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

Try this instead...

exiqgrep -i | xargs exim -Mrm