To see the total number of mails in the mailing queue:
Exim count mail in queue
exim -bpc
Use the following to see which scripts are sending out mail (helps keeping an eye on mailsenders and possible malware):
List the scripts sending mails and count for each one
grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F"cwd=" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -n
To clear the mailing queue:
Exim clear the mail queue
exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
Or even better, a “cleaner” approach:
exim -bp | exiqgrep -i | xargs exim -Mrm
To clear the Exim mailing statistics:
Clear Exim Statistics
cd /var/log
rm -fr exim*.1
rm -fr exim*.2
rm -fr exim*.3
rm -fr exim*.4
rm -fr exim_mainlog ; touch exim_mainlog ; chown mailnull.mail exim_mainlog
rm -fr exim_paniclog ; touch exim_paniclog ; chown mailnull.mail exim_paniclog
rm -fr exim_rejectlog ; touch exim_rejectlog ; chown mailnull.mail exim_rejectlog
To clean the eximstats MySQL database, enter MySQL with:
Enter the SQL eximstats DB
mysql eximstats
SQL commands (to be used within “mysql>”)
SQL commands to empty the tables
delete from sends;
delete from smtp;