Page 1 of 1

Need (desperately) a cron job

Posted: 02 Jul 2015, 01:42
by shpilkus
Exim just doesn't work. It won't remove Bounce messages no matter what we try putting in the Exim config. I deal with this using CMQ but it adds HOURS to my week as we maintain multiple servers. I asked Configservers and they politely refused to assist since it is free software, and suggested I ask on this or the cPanel forum. I see that these questions have been asked over and over again on this forum, going back 8 years, and no one has provided a solution. So I am not optimistic... but maybe this time will be the one?

What I need is the code that can be run from the command line that will delete BOUNCE messages from the MailScanner queue. Right now this happens with a few radio buttons and checkboxes but I need to set it up so it runs at least daily. Unchecked, these grow to 2000+ messages every 24-48 hours. Multiplied by multiple servers and we are just spending WAY too much time cleaning out the queue because Exim refuses to do what it is told. Surely this is an easy request, if I knew enough to reverse-engineer the CMQ program I would have already done so to extract the command.

So has anybody found a way to do this yet?

Re: Need (desperately) a cron job

Posted: 12 Sep 2016, 14:23
by alsmith
This is a lilttle script that may help

Code: Select all

#!/bin/sh
# removebounces.sh - remove bounce emails from email queue
# clear junk from queue
# remove all the [bounce] from the queue

echo "<br>Removing [bounce] emails from queue...";

/usr/sbin/exim -bpa | /bin/grep "<>" | /bin/awk -F" " '{print $3}' | while
read line
do
        #/usr/sbin/exim -C /etc/exim_outgoing.conf -Mrm $line
        /usr/sbin/exim -Mrm $line
done
echo "<br>Done Removing [bounce] emails from queue...";

Re: Need (desperately) a cron job

Posted: 12 Sep 2016, 15:03
by sawbuck
Nice one. Thanks Al

Re: Need (desperately) a cron job

Posted: 23 Mar 2017, 06:07
by ebizindia
This looks interesting. However, I use Mailscanner which moves the outbound queue to another instance of Exim.

Can someone please advise how to change the above script to refer to that instance of Exim?

Re: Need (desperately) a cron job

Posted: 23 Mar 2017, 06:25
by ebizindia
I will also like to delete emails from some addresses (these are autoresponses to spam which will never be delivered).

However, I will like to only delete the mails which are older than 2 hours.

Is it possible?

Re: Need (desperately) a cron job

Posted: 20 Feb 2019, 07:06
by Dorothy356
Interesting fix. I'll give it a try, since I'm having a similar problem.