My Community Dashboard

  • How to make it easy for users to train spamassassin to recognise mis-filed SPAM and HAM?

    I occasionally get spam emails which are not recognised as such, and ham emails which are being filed as spam.

    I want to set up a system for the users to tell spamassassin about unrecognised spam, and incorrectly spammed ham. To that end I set up additional folders in each user's mailboxes for Junk and NotSpam. The users move any spam they find in their inbox to Junk, and and normal mail they find in their spam to NotSpam.

    I now want to write or find a script which will look in the Junk folder, send the contents to sa-learn --spam, then move the messages to the regular spam folder. It should also look in the NotSpam folder, send the contents to sa-learn --ham, and move them into the inbox.

    I have tried to write shell scripts for this, and I have also downloaded and tried to follow sa-learn-cyrus, plus looked at the script I found at wiki.apache.org/spamassassin/RemoteImapFolder.

    My script finds the email files OK, and sends them to sa-learn (although I worry that the Spam score and subject alteration should really be reversed before doing this, and I don't know how). I'm stuck on moving the messages to the correct folder, as I suspect a plain Linux mv command will just confuse cyrus, as it has cache, header, index and squat files in the folder, which presumably need to be updated.

    sa-learn-cyrus seems to be able to find emails ok, but (as far as I can tell from running it in simulate mode) it does not attempt to move the mails to the right folder, just purges them.

    The other script runs OK (after suitable modifications for my setup), but the Junk emails keep reappearing in the inbox.

    Specific questions I need to answer are:

    1) Why does mail with [SPAM] in the Subject still appear in the INBOX?

    2) Is there an existing script which does what I want?

    3) What is the proper method to move an email from one mailbox folder to another in Cyrus? Ideally callable from a shell script.