delete emails

stomach

Verified User
Joined
Jan 2, 2024
Messages
89
[root@server cpanelimport2333223355]# exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | sh
exim: malformed message id 1rL3fb-0001IT-2x-H after -Mrm option
exim: malformed message id 1rL3fr-0001J4-0G-H after -Mrm option
exim: malformed message id 1rL3l4-0000Z0-2O-H after -Mrm option
exim: malformed message id 1rL3mU-0000Yo-0m-H after -Mrm option
exim: malformed message id 1rL3nY-0000Yz-33-H after -Mrm option
exim: malformed message id 1rL3wK-000OBI-32-H after -Mrm option
exim: malformed message id 1rL3wb-000OCw-23-H after -Mrm option
exim: malformed message id 1rL40v-0000bW-1q-H after -Mrm option
exim: malformed message id 1rL40y-0000dD-1r-H after -Mrm option
exim: malformed message id 1rL430-0000Zz-2I-H after -Mrm option
exim: malformed message id 1rL43q-0000Zy-1b-H after -Mrm option
exim: malformed message id 1rL44V-0000Zu-17-H after -Mrm option
exim: malformed message id 1rL4CE-0000Yj-29-H after -Mrm option
exim: malformed message id 1rL4CO-0000Zb-28-H after -Mrm option
exim: malformed message id 1rL4DN-0000bd-07-H after -Mrm option
exim: malformed message id 1rL4Ir-0001Rg-14-H after -Mrm option
 
What exactly is your question?
Can't you delete them via the mail queue manager from Directadmin?
 
You mean it's not deleting?

Ok you can try this script. It's not 100% working for all commands, but the option to delete the sender works fine. I've also got this from somebody else. But with these kind of files it sometimes works better.

Create a file called empty-exim.sh or something and chmod to 755.
Code:
#!/bin/sh
if [ $1 ]; then
echo "`exim -bpru | tr '\n' + | sed -e "s/++/=/g" | tr -d + | tr = '\n' | grep "$1" | awk {'print $3'} | xargs exim -Mrm | wc -l` E-Mails deleted"
else
echo "If you want to delete ALL the `exim -bpc` E-Mails on mail queue, give this command:"
echo "exim -bp|grep "<"|awk {'print $3'}|xargs exim -Mrm"
echo "or even better"
echo "exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash"
echo ""
echo "If you want to delete only mails with an specific sender/recipient, use:"
echo "$0 [sender/recipient]"
fi

So if you have a mail from foobar.com then use like this:
./emtpy-exim.sh foobar.com
and mails should be deleted.
 
If you're using mailscanner, check this thread:
 
Back
Top