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.

Clearing Mail Queue

Discussion in 'E-mail Discussions' started by yawsh, Jul 15, 2006.

  1. yawsh

    yawsh Well-Known Member

    Joined:
    Jun 20, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    Some times wrong email address registered in forums without activation may stack messages on the queue for some long time; hours or more.

    Is there any script around which is removing all messages which are on the queue for more than 'X' number time/hour? :cool:

    Or at least a corn job which run and check if there are any messages on the queue exceeded 24 hours; and just delete them (keeping other messages which are on the queue for less than 24 hours).


    Thanks in advance.
     
  2. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    You want my cron job script to clean the mail queue.
    (see my sig below)
     
  3. yawsh

    yawsh Well-Known Member

    Joined:
    Jun 20, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    any other totally free scripts?

    My country is not listed in paypal for donation.

    or any way to get the script?
     
  4. nxds

    nxds Well-Known Member

    Joined:
    Jan 6, 2006
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Display messages in queue for more than 24hrs:
    Code:
    exiqgrep -o 86400
    Delete messages in queue for more than 24hrs:
    Code:
    exiqgrep -o 86400 -i | xargs exim -Mrm
     
  5. yawsh

    yawsh Well-Known Member

    Joined:
    Jun 20, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    That works for me .. thank you very much nxds
     
  6. soft-t

    soft-t Member

    Joined:
    Jun 3, 2006
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hello Yawsh,

    You can use this command ar SSH to clearing mail queue

    Code:
    
    for msg in `exim -bp |grep -E '\w+-\w+-\w' |awk '{print $3}'`
    > do
    > exim -Mrm $msg
    > done
    
    :)
    Regards,
    Ahmed
     
  7. Blackcat

    Blackcat Member

    Joined:
    Sep 13, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Take care with this one, it will delete all mails in your mailq
     
  8. yawsh

    yawsh Well-Known Member

    Joined:
    Jun 20, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6

    Thanks ... I'm not using it :)

    I used nxds command as it is doing exactly what I asked for :cool:
     
  9. jbw

    jbw Registered

    Joined:
    Jul 23, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I know with sendmail you can configure how long to keep things queued. I would think exim might have a similar setting? If so that would be the best way to do it.
     
  10. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38

    Great , thanks !
     
  11. lowspeed

    lowspeed Active Member

    Joined:
    Aug 13, 2003
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1

    Nice stuff ! thanks ! Any disadvantages of using this ?
     
  12. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    The disadvantage is that you could easily delete legitimate email that is being queued for the reason that MTA queues exist for.
     
  13. hostww

    hostww Guest

    of course...

    Its all a question of how many emails in your queue more then 24hrs are valid... and how many peices of spam would you'd be dropping! :rolleyes:
     
  14. katz_global

    katz_global Well-Known Member
    PartnerNOC

    Joined:
    Oct 18, 2003
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Hosting from: Panama, Hong Kong, Singapore, Malays
    Some of our servers get over 1000 emails in the queue on a daily basis and each time this happens it will cause the server to come to a screeching halt, or at least raise the CPU levels higher than I would like.

    What do you recommend to do to run to automate the clearing of the queue at say over 500 messeges? How best to do this to keep legitimate email?

    Every time I expore the messages in a queue jam they always seem to be spam related.
     
  15. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Have you seen my cPanel/WHM scripts? You will probably like my "Auto Clean Mail Queue" script. The link is in my sig.
     
  16. beekeeper

    beekeeper Active Member

    Joined:
    Apr 28, 2003
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Melbourne, Australia
    WHM Queue Discrepancy

    Thank you for sharing this command which is very versatile.

    Does anyone know what exactly is displayed in the WHM mail queue manager? If I use exiqgrep -c to show a count of all queue messages I get 8,650 messages but WHM only indicates 3,970. Any ideas of why there is a discrepancy? (I have checked and the discrepancy is not frozen versus unfrozen) Any help here would be appreciated.
     
Loading...

Share This Page