Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Notification if Mail Queue Manager pass 100 emails

Discussion in 'E-mail Discussion' started by Diego.Vieira, Jan 21, 2012.

  1. Diego.Vieira

    Diego.Vieira Member

    Joined:
    Jul 19, 2010
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    51
    It's possible to get a notification if Mail Queue Manager pass 100 emails?
    thanks
     
  2. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    France
    cPanel Access Level:
    Root Administrator
    CSF will do what you want... among many other things :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Diego.Vieira

    Diego.Vieira Member

    Joined:
    Jul 19, 2010
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    51
    Thanks much!
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You could cron run a script like the following:

    Code:
    #!/bin/bash
    if [ `exim -bpc` -ge 100 ] 
    then echo "Exim queue at `exim -bpc`" | /bin/mail -s "Exim queue" myuser@mydomain.com
    else
    :
    fi
    The file could be called /root/eximqueue.sh and would need to be executable to run:

    Code:
    chmod +x /root/eximqueue.sh
    You could then put it into /var/spool/cron/root file to run every 15 minutes using this command:

    Code:
    */15 * * * * /root/eximqueue.sh
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #4 cPanelTristan, Jan 23, 2012
    Last edited: Jan 23, 2012
  5. Diego.Vieira

    Diego.Vieira Member

    Joined:
    Jul 19, 2010
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    51
    Thanks a lot!
     
  6. osirion

    osirion Well-Known Member

    Joined:
    Jan 16, 2007
    Messages:
    50
    Likes Received:
    4
    Trophy Points:
    158
    I tried the above script and its setup properly (cron / perms) but its not working. Anyone have something that would work? Im on CentOS...
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. osirion

    osirion Well-Known Member

    Joined:
    Jan 16, 2007
    Messages:
    50
    Likes Received:
    4
    Trophy Points:
    158
    I'm using one provided by my supplier, to move over to CSF is going to be a bit of a headache. Was hoping I could get a bash script going so long though
     
  9. osirion

    osirion Well-Known Member

    Joined:
    Jan 16, 2007
    Messages:
    50
    Likes Received:
    4
    Trophy Points:
    158
    Managed to get my hands on this:

    Code:
    #!/bin/bash
    
    ######### Edit here ##########
    
    _mail_user=someone@bob.com # Set this to your email id to receive alerts on mail queue
    _limit=100 # Set the limit here
    
    ##############################
    
    clear;
    _result="/tmp/eximqueue.txt"
    _queue="`exim -bpc`"
    
    if [ "$_queue" -ge "$_limit" ]; then
    echo "Current queue is: $_queue" > $_result
    echo "Summary of Mail queue" >> $_result
    echo "`exim -bp | exiqsumm`" >> $_result
    mail -s "Number of mails on `hostname` : $_queue" $_mail_user < $_result
    cat $_result
    fi
    
    rm -f $_result
    Works like a charm. Now I just have one question for someone slightly more advanced than me. Assuming the queue has exploded with spam, above message will just be in the back of the queue - so we would want to force it to be sent before anything else essentially.
    From my understanding, we can use the following to force delivery of one message:
    Code:
    /usr/sbin/exim  -M  email-id
    Anyone here know how I could extract the email-id from the scripts mail function and then run the above command with it?
    Something along the lines of:
    Code:
    _message_id = "'exiqgrep -f root@hostname'"
    /usr/sbin/exim  -M  "$_message_id"
    
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    It should send out on the first delivery attempt instead of staying in the mail queue. The mail in the queue typically failed on the initial attempt to deliver the message.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice