Page 1 of 3 123 LastLast
Results 1 to 15 of 36

Thread: How to delete mail from mail queue?

  1. #1
    Registered Member
    Join Date
    Oct 2004
    Posts
    11

    Default How to delete mail from mail queue?

    Does anyone know what commands I must type to delete mail from the mail queue which is located somewhere around the /var/spool/exim/ area? Each time I goto delete mail from WHM, it takes an extreme length of time. And pushes server load average to around 11.xx from it's normal 0.x to 1.x load. I know there's a way to remove it from root access in shell quickly and easily, can anyone help me with this?

    *Reason why I must do this is because there are over 100,000 emails in the mail queue from when spam was being sent and received from the server. Now it's must better since i've managed to stop most of it. But in the mean time, please can someone help please?

  2. #2
    Registered Member
    Join Date
    Mar 2004
    Posts
    716

    Default

    If you stop exim, you can then remove all the files - but you must also remove the database/index files at /var/spool/exim/db - otherwise you will get errors. I also recommend running /scripts/mailperm as that will help clean up the mess left over.
    Lloyd F Tennison

  3. #3
    Registered Member cPanel Partner NOC Badge
    Join Date
    Jun 2003
    Posts
    642

    Default

    Just do :

    rm /var/spool/exim/input/

    Keep exim running while you do this, that way it won't delete the directory or anything.

  4. #4
    Registered Member
    Join Date
    Oct 2004
    Posts
    11

    Default

    root@net1-sgstx [/var/spool/exim]# rm /var/spool/exim/input/
    rm: remove directory `/var/spool/exim/input/'? y
    rm: cannot remove directory `/var/spool/exim/input/': Is a directory
    root@net1-sgstx [/var/spool/exim]#

    I tried the above and it didn't work. I am thinking I must use the command rm -r /var/spool/exim/input/ yeah?
    Last edited by julzk; 10-18-2004 at 10:05 PM.

  5. #5
    Registered Member cPanel Partner NOC Badge
    Join Date
    Jun 2003
    Posts
    642

    Default

    now run "exim -btc"

    Most emails should be gone

  6. #6
    Registered Member
    Join Date
    Oct 2004
    Posts
    11

    Default

    I tried the command and it didnt work

  7. #7
    Registered Member cPanel Partner NOC Badge
    Join Date
    Jun 2003
    Posts
    642

    Default

    Sorry that should have been:

    Code:
    exim -bpc
    Typo.

  8. #8
    Registered Member
    Join Date
    Oct 2004
    Posts
    11

    Default

    yes, but the command to delete the input dir and contents in it?

    I tried the one you mentioned:

    rm /var/spool/exim/input/

    And it did not work. Gave me an error, I then tried it with: rm -r /var/spool/exim/input/

    and it started to work but prompted me on every email if I wanted to delete it.

  9. #9
    Registered Member cPanel Partner NOC Badge
    Join Date
    Jun 2003
    Posts
    642

    Default

    Do "rm -rf /var/spool/exim/input/"

    As long as you keep exim running, it will *not* delete the directory.

  10. #10
    Registered Member
    Join Date
    Oct 2004
    Posts
    11

    Default

    Ok, job is done.. I have cleared the queue and things are running back to normal. The problem I am having is spam is being sent from the server and to the server. I have installed an addon to exim which has now stabalised the server and sits nicely around the 0.44 load mark. But I still have the problem where the mail queue is still being filled up fast with spam mail. How can I stop this?

  11. #11
    Registered Member
    Join Date
    Mar 2004
    Posts
    716

    Default

    Quote Originally Posted by julzk
    Ok, job is done.. I have cleared the queue and things are running back to normal. The problem I am having is spam is being sent from the server
    Shut down the account doing the sending.

    Quote Originally Posted by julzk
    and to the server.
    If viruses - use an antivirus.

    Quote Originally Posted by julzk
    I have installed an addon to exim which has now stabalised the server and sits nicely around the 0.44 load mark.
    What addon are you talking about?

    Quote Originally Posted by julzk
    But I still have the problem where the mail queue is still being filled up fast with spam mail. How can I stop this?
    If above not enough, everything from SpamAssassin, etc. What kind of SPAM?
    Lloyd F Tennison

  12. #12
    Registered Member
    Join Date
    Mar 2004
    Posts
    716

    Default

    Quote Originally Posted by nickn
    Do "rm -rf /var/spool/exim/input/"

    As long as you keep exim running, it will *not* delete the directory.
    It would be a lot easier to DO stop exim and simply:

    #cd /var/spool/exim/input
    # rm -f *


    If ever worried about deleting directory simply change to it. You cannot delete the directory you are in while you are in it.
    Lloyd F Tennison

  13. #13
    Registered Member
    Join Date
    Jun 2003
    Posts
    177

    Default

    If you are dealing with a spammer on your server, now is not the time to be learning about server administration, you need to get someone that knows what they are doing and do this ASAP. You will end up either put on 1 or more RBL, have your IP's blacklisted or you could ultimately lose your server. None of these options are in your customers best interest. If you need a recommendation I have a couple really good guys I have used in the past.

  14. #14
    Registered Member
    Join Date
    Jun 2003
    Posts
    176

    Default

    I don't think it's a spammer on the box he's talking about. I've had the same problem from time to time. The problem is spam bounces. Spammer sends 2000 emails to bob@domain.com, sam@domain.com, etc. Just junk. domain.com bounces them back to the originator, which bounces them back to the admin for the box.

  15. #15
    Registered Member Host4u2's Avatar
    Join Date
    Mar 2002
    Posts
    245

    Default

    Most of the queue is probably bounces of bounces--which get frozen. In other words, mail that came to your server and failed, then your server sent it back but that failed too so it has nowhere to go. Instead of failing such messages, we resolved this same issue as follows:

    First, change all your email accounts default account to :blackhole:

    Example: to change all accounts with the default set as :fail: to :blackhole:
    The command to do this is:

    replace :blackhole: :fail: -- /etc/valiases/*
    replace /dev/null -- /etc/valiases/*

    Also, via WHM/Server Setup/Tweak Settings:
    Set Default catch-all/default address behavior for new accounts to Blackhole.

    Another thing you can do is change 'timeout_frozen_after = 7d' in exim.conf to something like 3d (days) instead of a week. This makes exim remove frozen messages after x number of days.

    We use RVskin, which also allows us to remove the ability to change the Default catch-all/default address behavior from client's Cpanel options.

Page 1 of 3 123 LastLast

Similar Threads

  1. Delete Mail Queue
    By compunet2 in forum General Discussion
    Replies: 7
    Last Post: 01-16-2008, 09:38 AM
  2. Cron Job to Delete Mail Queue
    By salvatore333 in forum General Discussion
    Replies: 14
    Last Post: 01-10-2008, 10:21 AM
  3. Replies: 2
    Last Post: 08-15-2007, 06:00 AM
  4. how to delete the mail in queue for perticular domain.
    By ngchandak in forum General Discussion
    Replies: 5
    Last Post: 07-04-2005, 12:30 PM
  5. Delete Mail Queue
    By adapter in forum General Discussion
    Replies: 1
    Last Post: 12-17-2004, 10:11 AM
bargain