The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can I flush the email queue?

Discussion in 'E-mail Discussions' started by jols, Jan 25, 2006.

  1. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Someone recently said our server email queue contains very old email and that we should flush it. This is probably an easy proceedure, I am not sure how to do it?
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Theoreticaly the following should work:

    exim -qff

    It doesn't always do very much. If you're using MailScanner, also try:

    exim -qff -C /etc/exim_outgoing.conf
     
  3. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Thanks, but does this flush the entire queue? Live/current email and all? Or just the really old/dormant stuff?
     
  4. verdon

    verdon Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    836
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Northern Ontario, Canada
    cPanel Access Level:
    Root Administrator
  5. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    I like that script. ;)
     
  6. verdon

    verdon Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    836
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Northern Ontario, Canada
    cPanel Access Level:
    Root Administrator
    I thought you might ;) It's a nice script.

    FYI... I found a nice tip here that helped me put the script in the add-ons section of WHM nicely and properly. I only had to add a couple lines to the script near the top...
    Code:
    #WHMADDON:cleanmailqueue:Clean Mail Queue
    
    BEGIN {
       push(@INC,"/usr/local/cpanel");
       push(@INC,"/usr/local/cpanel/whostmgr/docroot/cgi");
    }
    
    ...and rename the script to addon_PWScleanmailqueue.cgi
    ...and change the post url at line 106 to match the new name

    Now the script is where I want it in WHM, and the link to it has not been lost in cPanel/WHM updates.
     
  7. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    I know. That's what I'm working on, when I get a bit of free time. I'm going to switch all my WHM scripts to that and once the switch is made, all WHM scripts will be members only ones. I think I may actually have time to do that this weekend. ;)


     
  8. innsites

    innsites Well-Known Member

    Joined:
    Nov 30, 2005
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    Many frozen message in queue

    My mail queue now has over 750 messages "frozen" in it. If I attempt to deliver any of them automatically or manually, I get the reason why they have not gone through (user unknown, invalid recipient, etc) but WHY can't I force the mails all the way out so that the SENDER receives back a message as to why it failed or rejected? If I delete the queue, the sender's (my clients) will assume their mails were delivered.

    Am I correct?
     
  9. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    If you delete messages in the queue, the sender thinks it was sent and the recipient never gets it, but 99% of messages in the queue for more than a few days are either spam with invalid return addresses, or going to an account that is over it's limit.

    With my "clean mail queue" script, you can delete all emails over 3 days old which is pretty safe.
     
  10. verdon

    verdon Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    836
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Northern Ontario, Canada
    cPanel Access Level:
    Root Administrator
    the more important question is why do you have so many in the queue to begin with? I never have more than a few stuck in the queue. This number suggests that somebody is spamming through you server, or these is some other weakness in your setup.
     
  11. innsites

    innsites Well-Known Member

    Joined:
    Nov 30, 2005
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6

    A fair amount of clients forward their emails off to another account, say their ISP. This means that spam intended for that recipient is forwarding off as well. I did look at many mails and see this dilemma. The new receiving server does perceive some of these forwarded mails as spams, and says "no, thank you." I have no trouble deleting those.

    BUT, I do see some valid error messages that should go back to the sender, say invalid recipient. ALSO, all of the mailman lists stopped getting any bounces recently. I am trying to see if this issue is connected. I see "bad" test addresses we have been testing on mailman lists stuck in the queue.
     
  12. verdon

    verdon Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    836
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Northern Ontario, Canada
    cPanel Access Level:
    Root Administrator
    I was getting a lot of those too, until I switched to mailscanner. If you're not enabling scanning by default on domains, then strongly encourage users to start doing so. Also, I've found that 99.9% of the stuff flagged as low-level (likely to be) spam is indeed spam, so except in a very few cases, I just have that deleting and not being delivered or forwarded.

    I'm sorry I can't remember the exact reference, but there is a post in these forums that discusses get mail sent as nobody@host.com (what many webscripts will do) identified as what user it actually was and therefore getting bounces properly delivered.

    Good luck,

    One more thing, some of those invalid recipient bounces may also be from fwd'ed spam bouncing. I know a couple instance for sure where the recipient is valid, but spam sent to that address will bounce with an invalid recipient error.
     
    #12 verdon, Jan 29, 2006
    Last edited: Jan 29, 2006
Loading...

Share This Page