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) 12 queries took 5 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`17171
2DESCRIBE `comments`11111
3DESCRIBE `tags`221
4DESCRIBE `categories`221
5DESCRIBE `posts_tags`220
6DESCRIBE `categories_posts`220
7SELECT `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
8SELECT `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) 001
9SELECT `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
10SELECT `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
11UPDATE `posts` AS `Post` SET `Post`.`hitcount_rss` = Post.hitcount_rss + 1 WHERE `Post`.`id` = 9110
12UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 9110