eximrm

Here is a bash script to delete mails in exim mail queue. Helpful when you have lot of spam mails in mail queue.

Create file

vi /usr/local/bin/eximrm

Add

Advertisement

#!/bin/bash

exim -bpu | awk '{print $3}' | xargs exim -Mrm

Make it executable

chmod 755 /usr/local/bin/eximrm

Monitor Server Mail Queue

Run following script every 1 hour to monitor/alert email queue

#!/bin/bash

_mail_user=YOU@YOURDOMAIN.COM
_limit=250

_result="/tmp/serverok-exim-mailq.txt"
_queue="`/usr/sbin/exim -bpc`"

if [ "$_queue" -ge "$_limit" ]; then
    echo "Current queue is: $_queue" > $_result
    echo "Summary of Mail queue" >> $_result
    echo "`/usr/sbin/exim -bp | /usr/sbin/exiqsumm`" >> $_result
    mail -s "Number of mails on `hostname` : $_queue" $_mail_user < $_result
    cat $_result
fi

rm -f $_result
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement