You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Tim Litwiller <ti...@litwiller.net> on 2007/02/02 03:31:14 UTC

simple add address pattern to whitelist/blacklist script

I'm not much of a coder but I needed something for a client so they 
didn't have to call me to add addresses to the whitelist or blacklist, 
I'm sure other here can improve on this but thought maybe someone else 
needs this also.


---code---
#!/bin/bash
if [ ! $# == 2 ]; then
  echo "Usage:%0 (black|white) [address pattern]"
  echo "You can filter several different ways:"
  echo "multiple host in domain method       *.domain.com"
  echo "domain method                            *@domain.com"
  echo "single email user method           tom@domain.com"
  exit
fi

mode="$1"
addr="$2"

if [ $mode = "black" ] ; then
        echo "Black Listing $2"
        echo "blacklist_from $2" >> /etc/mail/spamassassin/blacklist.cf
        cat /etc/mail/spamassassin/blacklist.cf
else
        echo "White Listing $2"
        echo "whitelist_from $2" >> /etc/mail/spamassassin/whitelist.cf
        cat /etc/mail/spamassassin/whitelist.cf
fi
--- end of code ---