[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cyrus/Imap and sa-learn?



> Hej,
>
> I am wondering if anyone have any suggestions on how to do a cron
> based
> sa-learn on a SaLearn.spam and a SaLearn.ham folder in Cyrus/Imap.
>
> I want to move/copy misslabeld mails to these folders and have run
> regurlar (hourly?) sa-learn on these folders (each user should have
> them, about 10 users or so)
>
> ==> Will the fact that sa-learn is reading/touching the files affect
> Cyrus/Imap? (The access flag for instance)
>
> ==> Do I need to stop Cyrus to read?
>
> ==> Any suggestion on how to move the contents of SaLearn to other
> folder from the script. To clean up the SaLearn folders.
> I want to keep all Spams in Spam folder, and Ham in other folders.
>
> Thank you in advance for any and all answers
>
> /Bengt


My setup might be similar to yours.

I have 2 folders, HAM and SPAM.  I move legit emails to HAM, and
unwanted to SPAM.  Addittionally, my procmail places all the spam mail
(over 5.0) to SPAM folder.

After learning from HAM and SPAM, I want the emails moved to Trash.

Also, I do not want the scripts to take the unread spam to trash,
since I want to review it and discard some false positive.  I usually
just mark all the spam as read and leave it in SPAM, and the scripts
take care of it.  Beware though, once any IMAP client scans the SPAM
folder, all the files are moved to "cur" from "new", and they will be
picked up by my scripts.

So, here are the scripts:
learn-ham:
/usr/bin/sa-learn --ham --dir /home/bojan/Maildir/cur
/home/bojan/Maildir/.HAM/cur /home/bojan/Maildir/.HAM
find /home/bojan/Maildir/.HAM/cur/* -exec mv {}
/home/bojan/Maildir/.Trash/cur/ \;


learn-spam:
/usr/bin/sa-learn --spam --dir /home/bojan/Maildir/.SPAM/cur
find /home/bojan/Maildir/.SPAM/cur/* -exec mv {}
/home/bojan/Maildir/.Trash/cur/ \;


and crontab:
#
# Run the script to learn spam from the read SPAM folder and move it
to Trash.
#
13 0-23/6 * * *                 /home/bojan/learn-spam >>
$HOME/logs/learn-spam.log

#
# Run the script to learn the ham drom the HAM folder and read INBOX
and move all the mails from HAM to Trash.
#
43 0-23/6 * * *         /home/bojan/learn-ham >> $HOME/logs/learn-ham.log


Now, there are other setups (some probably better), but this is what I
am comfortable with.

I hope this helps somewhat.

Bojan



Reply to: