Forums

Resolved
0 votes
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"?
Tuesday, January 30 2018, 03:52 PM
Share this post:
Responses (3)
  • Accepted Answer

    Wednesday, January 31 2018, 09:14 PM - #Permalink
    Resolved
    0 votes
    That is fine. Effectively Roundcubemail provides the interface for Sieve rules/filters in ClearOS, but it is a paid app. You've gone straight to the underlying files which allows you to trigger a more powerful script.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, January 31 2018, 08:17 PM - #Permalink
    Resolved
    0 votes
    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:


    # cat spamrule
    require
    ["fileinto","envelope","reject","vacation","imapflags","relational","comparator-i;ascii-numeric","regex","notify"];
    if header :contains "x-spam-flag" "YES" {
    fileinto "user/nikki/SPAM";
    stop;
    }


    And, when logged in as user nikki, I can add this rule to the system using sieveshell as follows (nb: the sieveshell prompt is >;):


    sieveshell -u nikki localhost:2000
    Please enter your password:
    > put spamrule
    > activate spamrule
    > list
    spamrule <- active script
    > quit


    Of course, this presupposes you can open a shell for each user (I logged in as root and used
    su -s /bin/bash - nikki
    ), and that you know each user's password (which I do).
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, January 30 2018, 08:30 PM - #Permalink
    Resolved
    0 votes
    I am not aware of ClearOS 6.x being able to move spam mail automatically, but it may just be a faulty memory. There are two ways of doing it that I know. It can be done in your e-mail client. In Thunderbird, for example, you can set up message rules which trigger on the subject line or there is also a specific Junk Mail setting which allows you to "Trust junk mail headers set buy:" and pick Spamassassin. The other way is to use sieve rules. The paid-for version of Roundcume allows you to do this. If you set the rule in Roundcube, Roundcube does not have to be running for the rule to function. Both methods have the disadvantage that it is a per user function and not global. I do not know how to set this globally. I looked years ago before I even had Roundcube but got nowhere. In those days I think I was under ClearOS 5.x and Horde.
    The reply is currently minimized Show
Your Reply