#===================================================================== # # Name # spamkw.pl # # Author # Lance P. Cleveland, Charleston Software Associates (www.CharlestonSW.com) # # Purpose # A simple procmail script that filters email based on 3 parameters: # a) A keyword present anywhere in the subject line # b) A phrase (multiple words in EXACT order) present anywhere in the subject # c) Coming in from a specified address # # Use in conjunction with our spamkw.cgi program to manage the 3 # supporting files that contain the keywords & phrases. # # Supporting Files (all in the configured PMDIR) # a) keyword.blacklist # b) subject.blacklist # c) from.blacklist # # Example a) keyword.blacklist contains (no leading/trailing spaces) # \[adv\] # adu1t # adv: # # Example b) subject.blacklist # adult dvds # buy direct # # Example c) from.blacklist # \ # \ # # Info # What is procmail? # Procmail provides a simple server-side interface for pre-scanning # email as it arrives on the server. You can set rules that determine # where mail ends up based on the incoming text. For instance, send # all mail from @spamking.com to the bit bucket. # # About CSA # Charleston Software Associates (CSA) is and advanced internet technology # consulting firm based in Charleston South Carolina. We provide custom # software, database, and consulting services for small to mid-sized # businesses. # # For more information, or to schedule a consult, visit our website at # www.CharlestonSW.com # # Contributions # Like the script and want to contribute? # You can send payments via credit card or bank transfer using # PayPal and sending money to our info@charlestonsw.com PayPal address. # # Copyright # (c) 2005, Charleston Software Associates # This script is covered by the GNU GENERAL PUBLIC LICENSE. # View the license at http://www.charlestonsw.com/community/gpl.txt # or at http://www.gnu.org/copyleft/gpl.html # #===================================================================== GREP=/bin/grep SUBJ=`formail -x 'Subject: '` FROM=`formail -x 'From: '` TO=`formail -x 'To: '` # Known Bad Key Words :0 * ? (echo "$SUBJ" | $GREP -iw -f $PMDIR/keyword.blacklist) { LOG="SPAM PERM DELETED (keyword in SUBJECT below)... " :0 $PMDIR/spamtrap.mail } # Self Generated Blacklist # :0 * ? (echo "$SUBJ" | $GREP -i -f $PMDIR/subject.blacklist) { LOG="SPAM PERM DELETED (phrase in SUBJECT below)... " :0 $PMDIR/spamtrap.mail } # Bad From # :0 * ? (echo "$FROM" | $GREP -i -f $PMDIR/from.blacklist) { LOG="SPAM PERM DELETED (from in FROM below)... " :0 $PMDIR/spamtrap.mail }