Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: shell script to auto whitelist people you've emailed

...

Another feature of spamassassin is "auto-whitelist". But the name is a misnomer. The AutoWhitelist is designed as an automatic score averaging system, and is just as likely to penalize or blacklist an address as it is to benefit or whitelist it. If you want to whitelist, you should use the directions above.

Automatically whitelisting people you've emailed

To extract a unique list of e-mail addresses from your 'Sent' folder (in mbox format), you could use something like this:

No Format

#!/bin/sh

SADIR=~/.spamassassin
SENTMAIL=~/mail/Sent

rm -f $SADIR/sent_whitelist
for x in `grep "^To:" $SENTMAIL |
	grep -o "[[:alnum:]\.\+]*@[[:alnum:]\.]*" |
	tr -s "A-Z" "a-z" |
	sort -u` ;
	
	do echo "whitelist $x" >> $SADIR/sent_whitelist
done

cat $SADIR/user_prefs.base $SADIR/sent_whitelist > $SADIR/user_prefs	

This can be adapted as necessary, and executed as a cron job.

contributors