#!/bin/bash # # spamprobe_update: accept advice from user about what is and is not # spam # # This script is intended for systems using Maildir format to store # e-mail messages. Each message will be in a single file, in a # subdirectory of the Maildir directory in the user's home directory. # # The user keeps two special directories, and places e-mail message # files # into them. One directory, "missedspam", flags a message as spam; the # other, "nonspam", flags a message as non-spam. # # Any spam e-mail not recognized by SpamProbe should be placed by the # user into missedspam. Likewise, any e-mail mistakenly flagged as spam # by SpamProbe should be placed into nonspam. When this script is run, # SpamProbe will update its databases from the messages in the two # special directories, and then in future can improve its accuracy. SP=/usr/local/bin/spamprobe cd if test ! -d Maildir; then exit 0 fi cd Maildir if test ! -d .Spam.missedspam -a ! -d .Spam.nonspam ; then exit 0 fi if test ! -d .Spam.missedspam -a -d .Spam.nonspam ; then echo "$0: \"missedspam\" directory missing" echo "Please forward this e-mail to: root@localhost" exit 1 fi if test -d .Spam.missedspam -a ! -d .Spam.nonspam ; then echo "$0: \"nonspam\" directory missing" echo "Please forward this e-mail to: root@localhost" exit 1 fi # flag spam messages, and nuke find .Spam.missedspam/cur -type f -exec $SP spam {} \; -exec rm {} \; # flag nonspam messages, and place in Inbox find .Spam.nonspam/cur -type f -exec $SP good {} \; -exec mv {} cur/. \;