How to purge your exim emails and handle a Line mismatch error

Just a quick post mainly for my reference on how to purge your exim mail queue and handle the "Line mismatch:" error you can get sometimes when things aren't working as they should.

You can list all of the messages backed up with the commands:

Show Plain Text
Text code
  1. exim -bp
  2. // or
  3. mailq

To remove a particular message from the queue:

Show Plain Text
Text code
  1. exim -Mrm {message-id}

To remove all of the messages in the queue:

Show Plain Text
Text code
  1. exim -bp | exiqgrep -i | xargs exim -Mrm
  2. // or
  3. exiqgrep -i | xargs exim -Mrm

However sometimes the above doesn't work and you get "Line mismatch: ". To handle this and still delete all the darn messages you can use:

Show Plain Text
Text code
  1. exim -bpru | grep '<code>' | awk '{print $2}' | xargs -n 1 -P 20 exim -Mrm

You might need to run it a few times, just use the mailq command to get the to delete.

Filed under: Linux  Tags: Debian, Ubuntu

0 Responses to “How to purge your exim emails and handle a Line mismatch error”

Sorry, comments have been closed for this post.