[Dovecot] sa learning from an imap spam folder

mouss mouss at netoyen.net
Thu Jan 31 21:56:03 EET 2008


Evaggelos Balaskas wrote:
> Just because i am too boring to fix it correctly
> (move old spam to another location etc - etc),
> i have just done this:
>
> crontab -l
>
> 10 */1 * * * /bin/ls -1 /var/mail/folders/ebalaskas/.spam/cur | xargs
> /usr/local/bin/sa-learn --spam
>
> PS: sorry for being lazy

but not lazy enough to remove the ls and xargs (or do you like pipe 
rigati :)
    /usr/local/bin/sa-learn --spam /var/mail/folders/ebalaskas/.spam/cur/

but it doesn't take much more to write a script:

#!/bin/sh

learn_spam="/usr/local/bin/sa-learn --spam"
spam_dir=/var/mail/folders/ebalaskas/.spam
corpus_dir=${spam_dir}/corpus
aux_dir=${spam_dir}/tolearn

mkdir -p ${corpus_dir}
mkdir -p ${aux_dir_dir}
mv ${spam_dir}/cur/* ${aux_dir}/
${learn_spam} ${aux_dir} && mv ${aux_dir}/* ${corpus_dir}












More information about the dovecot mailing list