I have approached the idea from a different, and I think better, angle. All mail which SpamAssassin things is spam has an X-Spam-Flag: YES header, and mail which it thinks is ham has a X-Spam-Flag: NO header. So, if I just tell users to move any misfiled mail into the right folder, I can then look through it for headers which don't match the folder.
To that end, I have written a bash script to do that very job, and placed it on GitHub at cyrus-mark-ham-spam.
I have solved this!
Cyrus has a built-in filtering system which can redirect mail to folders according to rules you supply. I found on my old server I had set up some rules, but had forgotten all about it.
The rule I needed (for user nikki) was:
And, when logged in as user nikki, I can add this rule to the system using sieveshell as follows (nb: the sieveshell prompt is >:
Of course, this presupposes you can open a shell for each user (I logged in as root and used ), and that you know each user's password (which I do).
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.
I am running ClearOs 7 Community. I have set up IMAP, SMTP and AntiSpam, so I can receive emails from outside, and read them with IMAP.
I am getting emails which are clearly spam (they have [SPAM] in the subject), but they are arriving in the INBOX. I want them to do the same as they used to do in my old server, and be moved into the SPAM folder.
There doesn't seem to be any configuration in the UI to do this. How do I do it "by hand"?
I think you may be getting the two threads confused. The events in my other thread (about cyrus imap repeatedly calling sudo) are coming from the secure log. These are not coming from any log file.
Are we both on ClearOs 7 Community Edition?
Perhaps you have a different app which creates that database?
I have mariadb installed for other reasons, and the only possible relevant database is performance_schema, but there appears to be no data in most of the tables.
Besides, the source code (if I have the right app) specifically mentions a SQLite database.
Nick: I see those buttons now - I was looking on a 10" tablet, and the sidebars were hidden!
Mansoor: Software Repository has no messages today. When I first installed it (yesterday) it complained that clearos-centos and clearos-centos-updates weren't enabled (so I enabled them). So perhaps the warning was related to that.
I am quite surprised that, if those repos are important, they are not enabled by default.
Also, it would be useful if the messages in the Events and Notifications app gave a better idea of what was wrong, and where to go to fix it. I imagined that clicking on a message would give more information, or take me to the app or log that created the message, but unfortunately not.
If I had a better idea how the app worked, I might submit a patch. Unfortunately my reading of the source code of app-events indicates the events are stored in a database, but a as root fails to find the named file, so how it works remains a mystery.
I am looking at the output of the "Events and Notifications" app. It says there is a warning message, but there is no obvious way of finding it (the app should have a filter to only show errors, or only errors and warnings). I tried typing "warning" into the search box, and I saw loads of messages saying "Software repository configuration warning(s)".
Now I wonder what that means, and where to go to fix it. But there is no help in the app.
I tried searching all the log files for a similar message, but found nothing. What is the use of a warning tgat gives you no clue what to do about it?
Yum command worked. Nothing to update.
Yum repolist gives:
However, when I attempted to install before, clearos-centos and clearos-centos-updates weren't enabled. I only enabled them on the advice of the Software Repositories app I installed yesterday. They were not enabled out of the box.
I have just tried to install again,and it has worked. I suspect the install requires one or both of those repositories to be enabled.