Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    May 2004
    Posts
    9

    Default remove specific messages from exim queue

    A user on one of my servers had bad PHP code which caused a mail loop. There are over 20,000 messages sitting in the queue that are from this particular user. How can I remove those specific messages without harming other valid messages in the queue?

  2. #2
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    You could script something to remove only mail based on your search criteria.

    Here's a quick dirty way that may do what you need though

    # cd /var/spool/exim/input

    # grep -r 'sender@domain.com' * | awk '{print $1}' | cut -d: -f1 | xargs rm -f

    Try without the | xargs rm -f first, to see what will be removed maybe.

    # grep -r 'sender@domain.com' * | awk '{print $1}' | cut -d: -f1

    Use at your own risk.

  3. #3
    Member
    Join Date
    May 2004
    Posts
    9

    Default

    Yeah, I was thinking about that. I thought there may have been a more efficient way (like qmail has qmail-remove). Greping 20,000+ messages isn't something that is very effieicent, however it may get the job done

  4. #4
    Member
    Join Date
    Sep 2004
    Posts
    422

    Default

    Indeed, you might want to 'nice' it to avoid high loads while grepping.

  5. #5
    Member
    Join Date
    Apr 2003
    Posts
    174
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    I've been using a script I wrote based on this thread for several months to remove certain mass emails from the queue. I've just discovered a problem with this method that others may like to know about.

    It started when I noticed that it was taking a very long time to grep the few hundred messages in the queue - well over 10 minutes, probably more. So I decided to take a little look inside the directories inside /var/spool/exim/input and instantly noticed there were many, many more files than there should be. After some poking around, I soon discovered the problem: Exim stores the message headers in separate files to the message bodies, and this method of removing messages only removes the headers! I still had the message bodies from month's worth of deleted mail sitting there. I counted the files and there were well over 150,000 of them, that's over 600MB of data. No wonder grep was taking so damn long

    I did the following to clean up the mess, without removing the few legitimate messages in the mail queue:
    Code:
    cd /var/spool/exim/input/
    for f in */*-D; do if [ ! -f `echo $f | tr -- -D -H` ]; then rm -f $f; fi; done
    This command is still running and has so far removed about 100MB worth of files. It's not exactly fast, but it's working

Similar Threads & Tags
Similar threads

  1. Filter queue and remove messages to one domain
    By chuza in forum E-mail Discussions
    Replies: 0
    Last Post: 11-25-2009, 11:03 PM
  2. Exim - Script for Remove Messages from Queue - Based on body of message
    By minotauro in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-23-2004, 05:15 PM
  3. Deliver only messages to a specific domain in Mail queue
    By NetX in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-07-2004, 10:53 AM
  4. Deleting messages from EXIM queue.
    By eter4 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-30-2003, 04:48 PM
  5. Deleting Specific messages in Queue
    By eter4 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-26-2003, 06:06 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube