Mark as junk in Evolution, train SpamAssassin on server

Evolution has a feature for marking e-mail as junk. This will set an IMAP keyword “Junk” on those messages. On my mail server I run Dovecot as IMAP server and Spamassassin through Amavis to filter spam. How could I get Spamassassin to learn that all e-mails marked as junk in Evolution are spam? With a shell script, of course. I currently run it as root but maybe it is possible to give the amavis user permissions to read my Maildir…

#!/bin/sh

if [ `whoami` != 'root' ]; then
  exec sudo $0 [email protected]
fi

find ~david/Maildir -name dovecot-keywords | (
while read keywords; do

  DIR=`dirname $keywords`
  #echo $DIR >&2
  # XXX only supports 10 keywords
  CHAR=`awk '$2 == "Junk" { print $1; quit;  }' $keywords |
    tr '0-9' 'a-j'`

  if [ "$CHAR" ]; then
    find $DIR/cur $DIR/new -regex "[^,]*,[^,]*$CHAR.*" |
      xargs sa-learn --dbpath /var/lib/amavis/.spamassassin/ --spam
  fi

done
)
/etc/init.d/spamassassin reload

Helpful pages: Maildir format used by Dovecot, Spamassassin with amavis: Tips and tricks.

Policy notification from Google

My Swedish site Folkmun allows anyone to add words and their definitions. It’s a simple Swedish version of Urban Dictionary. Some people add very explicit words and I had totally forgotten that such words may clash with Google AdSense policies. Today I received a friendly warning:

While reviewing your account, we noticed that you are currently displaying Google ads in a manner that is not compliant with our policies. For instance, we found violations of AdSense policies on pages such as
//www.folkmun.se/definition/Apaj%C3%A4vel. Please note that this URL is an example and that the same violations may exist on other pages of your website.

Needless to say, I have made a couple of modifications to the site, including hiding ads when displaying explicit words or definitions. If this wasn’t good enough, I’ll know in a couple of days…

New site: Blekinge.IT

As much as I try to get rid of domains I don’t use, I can’t avoid registering new domains. I recently registered two domains (singular and plural) for a project with codename Green November.

Another domain I recently registered is Blekinge.IT. At some point in the future I want it to be a site about IT and telecommunications in the Swedish province Blekinge, but for now I only use it to aggregate local news sources.

This was also a test in registering .it domains. I had to print, sign and send a fax (!) to fulfill the registration, but otherwise it was really easy.