| « Create a new mailing list in Horde webmail | Where is my Firefox web cache? » |
Deleting emails with a certain subject on the Plesk server
April 14th, 2009Occasionally a user will receive so much email that it blows the file system limit for a domain. This can be because they haven’t picked up their mail for a while or the domain has fallen into disuse.
Usually when you tell the user they have 6,000 emails to go through they start to cry! You as an administrator can help reduce the number. Generally speaking most of the emails will be spam. Here is a quick clean up program that will find and delete all the mail messages with a subject starting with “*****SPAM". These emails have been tagged by SpamAssassin as junk mail.
Code:
cd /var/qmail/mailnames/mydomain.com/firstname.surname/Maildir/new | |
ls | while read file | |
do | |
sub=`grep '^Subject: \*\*\*\*\*SPAM' "$file"` | |
if [ "$sub" != "" ] | |
then | |
echo "$file : $sub" | |
rm -f "$file" | |
fi | |
done |