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.
(default) 5 queries took 0 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1SELECT `Post`.`id`, `Post`.`url`, `Post`.`title`, `Post`.`icon`, `Post`.`metadesc`, `Post`.`metakeys`, `Post`.`categories`, `Post`.`tease`, `Post`.`body`, `Post`.`private_body`, `Post`.`created`, `Post`.`modified`, `Post`.`status`, `Post`.`allow_comments`, `Post`.`tags`, `Post`.`hitcount`, `Post`.`hitcount_rss` FROM `posts` AS `Post` WHERE `Post`.`url` = 'how-to-purge-your-exim-emails-and-handle-a-line-mismatch-error' LIMIT 1110
2SELECT `Comment`.`id`, `Comment`.`post_id`, `Comment`.`body`, `Comment`.`author`, `Comment`.`url`, `Comment`.`email`, `Comment`.`ip`, `Comment`.`status`, `Comment`.`junk_score`, `Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment` WHERE `Comment`.`status` = 2 AND `Comment`.`post_id` = (91) 000
3SELECT `Tag`.`id`, `Tag`.`tag`, `PostsTag`.`post_id`, `PostsTag`.`tag_id` FROM `tags` AS `Tag` JOIN `posts_tags` AS `PostsTag` ON (`PostsTag`.`post_id` = 91 AND `PostsTag`.`tag_id` = `Tag`.`id`) 220
4SELECT `Category`.`id`, `Category`.`category`, `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id` FROM `categories` AS `Category` JOIN `categories_posts` AS `CategoriesPost` ON (`CategoriesPost`.`post_id` = 91 AND `CategoriesPost`.`category_id` = `Category`.`id`) 110
5UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 9110