I was looking whole morning and found nothing.
I have a debian box running dovecot IMAP. I want to train the spamassassin with the users spam folders.
is there something similar like sa-learn-cyrus for dovecot?
I was looking whole morning and found nothing.
I have a debian box running dovecot IMAP. I want to train the spamassassin with the users spam folders.
is there something similar like sa-learn-cyrus for dovecot?
SpamAssassin comes with sa-learn
out of the box (not to be confused with the sa-learn-cyrus
you mentioned). It comes with two learning modes, ham and spam. It would take a very, very simple script to walk through each user's mailbox, doing a "ham" pass at first, and a second walk-through for "spam". Something (roughly) like:
#!/bin/bash
# change these to reflect the folder layout used on your server
BASEDIR=/home
UINBOX=Maildir/Inbox
USPAMBOX=Maildir/Spam
# do some housekeeping...
sa-learn --force-expire
# enumerate each user and process ham/spam
for USRNAME in `ls -l /home`
do
for MAILSTATE in new cur
do
sa-learn --ham $BASEDIR/$USRNAME/$UINBOX/$MAILSTATE/*
sa-learn --spam $BASEDIR/$USRNAME/$USPAMBOX/$MAILSTATE/*
done
done
Place in in a file, let's call it sa-trainer.sh
. I included the already-read mail as part of the process, just in case something is read (intentionally or accidentially). It won't matter much to the process, as the duplicates will be detected and effectively ignored.
I wrote my own script using doveadm search
to read training mails from certain IMAP folders in my own account.
The usual disclaimers apply, it is not pretty but works for me.
You will also have to remove the crm114 mailtrainer.crm
call at the end.
Edit: I realized my script also uses crm114 feature (a cache dir of all processed messages in crm114/reaver_cache/texts), so it will not work for normal installations.