Spamfilter + per user whitelist

Discussion in 'Installation/Configuration' started by ispcomm, May 18, 2017.

  1. ispcomm

    ispcomm Member

    I am trying to get end users to use the Junk mail folder and to stop complaining about spam mail in their inbox. To do this I enable the "Move to Junk" option in the spamfilter settiings of all mailboxes.
    However, there's an issue as some people like some mailing lists and those mailing lists end up in the spam mailbox (rightly so, as SA does not know if the user likes or does not like a particular lists).
    The normal solution would be to whitelist the sender, so that the mail is not tagged as spam and not stored in junk, however, there's no way to a end user of a mailbox to add whitelist.
    The closest that comes by is to create a sieve rule that will save the mail in INBOX instead of Junk. This does not work however, as the "Move to Junk" sieve rule is in front of the custom user rules. This is what happens to .sieve when a rule is added:
    Code:
    require ["fileinto", "regex", "vacation"];
    
    
    # Move spam to spam folder
    if header :contains "X-Spam-Flag" "YES" {
      fileinto "Junk";
      # Stop here so that we do not reply on spams
      stop;
    }
    
    ### BEGIN FILTER_ID:16
    if header :regex    ["from"] ["[email protected]\.ext$"] {
        fileinto "INBOX";
        stop;
    }
    ### END FILTER_ID:16
    
    
    keep;
    
    If a mail is tagged SPAM, it will never make it to mailbox as processing ends earlier.
    Perhaps, user-defined rules shall take precedence over the "default" move to junk ?
    Are there other ways to solve this issue ?
     
  2. Jesse Norell

    Jesse Norell Well-Known Member

    You might file a bug report at https://git.ispconfig.org/ispconfig/ispconfig3/issues on that, as indeed it seems like the default fileinto Junk should be last. (search and make sure you don't find an existing issue first of course)

    As far as ways to accomplish this, first there is a Spamfilter Whitelist could be used if you can setup appropriate client accounts. I can see scenarios where that doesn't work though, where you want an email account to manage it themselves without giving them client access. Maybe file a feature request at the issue tracker for that? But if someone with client level access or above is involved in creating the sieve filters (which is probably beyond the tech-ability of a typical end-user), you could just use that.

    Next, you could use your sieve solution by turning off the 'Move to Junk' option, and then just add your own rule to do the same thing at the end of your custom rules.

    Other than that, I'd look at improving the spamfilter to not tag those as spam in the first place. Train your spam scanner with some of those messages. See what rules those messages are hitting and what could be done to help (eg. make sure your spamassassin install is up to date, and that it uses dns whitelists as well as blacklists).
     
  3. ispcomm

    ispcomm Member

    Filed issue here:
    https://git.ispconfig.org/ispconfig/ispconfig3/issues/4664

    The email accounts can manage themselves via the roundcube pluings. I'd like to enable move-to-junk for all emails automatically, but I have to give them a way to whitelist recipients. I cannot whitelist every single recipient on the global server whitelist as this will increase support time/ticketing etc.

    The viable solution now is to make the custom rules, but there is no currently a way to add a header check in the gui (perhaps this is a source for another request for enhancement).

    ispcomm
     

Share This Page