Quote:
|
Originally Posted by pseudoswede
Is there a way to modify the script so that it deletes mail from both the HAM and SPAM folders after it's been analyzed?
|
Yes, it's actually in the script already... only partially in place. I don't know that I'd totally dump the file because if it's empty the next time you run the script, you'll get errors that are harmless, but not needed.
I also wouldn't clean out the SPAM folder just because it is good to keep 500 spam messages ready to be re-learned in case the Spam Assassin databases become lost.
However, this will clean out the file.
Code:
#!/bin/sh
echo "Learning SPAM"
for FILE in `find $HOME -name SPAM -print`
do
echo "Processing $FILE"
sa-learn --spam --mbox $FILE
cat /dev/null > $FILE
done
echo "Learning HAM"
for FILE in `find $HOME -name HAM -print`
do
echo "Processing $FILE"
sa-learn --ham --mbox $FILE
cat /dev/null > $FILE
done
echo "Done"
This will remove it altogether.
Code:
#!/bin/sh
echo "Learning SPAM"
for FILE in `find $HOME -name SPAM -print`
do
echo "Processing $FILE"
sa-learn --spam --mbox $FILE
rm $FILE
done
echo "Learning HAM"
for FILE in `find $HOME -name HAM -print`
do
echo "Processing $FILE"
sa-learn --ham --mbox $FILE
rm $FILE
done
echo "Done"