Hi,
I migrated my e-mails to a private dovecot server and collect all my
external mail accounts using getmail.
I wrote a sieve script to filter the mails and sort them into Spam
folders. Just for people who want to try, here is the script:
require ["fileinto", "imap4flags", "vnd.dovecot.filter"];
filter "spambayes_filter.sh";
if header :contains "X-Spambayes-Classification" "unsure" {
# move to spam
fileinto "Spam";
stop;
} elsif header :contains "X-Spambayes-Classification" "spam" {
# mark as read and move to spam
setflag "\\seen";
fileinto "Spam";
stop;
} else {
keep;
stop;
}
spambayes_filter.sh is a script in the "sieve_global_dir" (see dovecot
settings below) and looks like this:
#!/bin/bash
export BAYESCUSTOMIZE=/PATH_TO_INI/bayescustomize.ini
export PYTHONPATH=/PATH_TO_SPAMBAYES_ROOT_FOLDER/
python /PATH_TO_SPAMBAYES_ROOT_FOLDER/scripts/sb_filter.py -d
/PATH_TO_HAMMIE.DB/hammie.db
Of course you have to adjust the paths to python, your ini file and
hammie.db.
There are a few dovecot settings necessary. In my Ubuntu trusty dovecot
config those all are in the default /etc/dovecot/conf.d/90-sieve.conf.
You need to set sieve_global_dir to some folder where you keep the
script above (and better set rights that nobody except root can write to
it in order to not allow users/attackers to add additional programs).
Then I set the above script as "sieve_before", i.e. it will run before
all user sieve scripts.
sieve_global_extensions= +vnd.dovecot.filter +editheader
is necessary for the script
sieve_plugins = sieve_extprograms
is necessary to load the external programs plugin which is necessary to
run spambayes in the sieve scripts.
Just in case someone needs this (somebody asked for something like this
a few months ago, IIRC).
Achim
_______________________________________________
SpamBayes@python.org
https://mail.python.org/mailman/listinfo/spambayes
Info/Unsubscribe: http://mail.python.org/mailman/listinfo/spambayes
Check the FAQ before asking: http://spambayes.sf.net/faq.html