Roundcube filter to keep spam in inbox

Hello,

I’m attempting to add a Roundcube filter to move messages mistakenly classified as Spam from certain domains to the Inbox. I’ve set up my filter as follows:

Where From contains example-domain.com,
Move message to Inbox
and Stop evaluating rules

However, the above is not working; the messages from example-domain.com are still going to Spam. Is this because the Spam filter processes the message before it gets to Roundcube’s filter rules? Should I select a different action instead of Move, like Redirect Message To or Keep Message in Inbox?

I know that I could manually add example-domain.com to the Spamassassin whitelist via CLI, but this is much less convenient than creating a filter right from the Roundcube interface. And there’s no way my “users” (family) would mess with the CLI.

Thanks!

Sometimes this is caused by a client spam filter. Have you verified no devices are able to access the server when this happens?

The sieve filter is a dovecot plugin, so that is after spamassassin.

OK, I guess that explains it. spamassassin is moving the email to Junk before dovecot even sees it. The only option seems to be to edit the spamassassin config file to create a whitelist.

What I mean is the order of how the message travels:

Postfix accepts > spampd sends to Spamassassin → Spamasassin returns to spampd → Spampd sends to Dovecot.

Or, at least that’s how I understand it, so the sieve filter is applied after Spamassassin.

I have used both, though each for different reasons, and I’m pretty sure the sieve filter will pull messages out of the Spam folder, but I might be mistaken.

Thanks, you set me on the right path. I checked the sieve configuration at /etc/dovecot/conf.d/99-local-sieve.conf, and I noticed the line sieve_before = /etc/dovecot/sieve-spam.sieve which is the filter handling spam. Since this filter is specified in sieve_before, it is executed before all of the user filters in Roundcube.

The contents of sieve-spam.sieve are as follows:

require [“regex”, “fileinto”, “imap4flags”];

if allof (header :regex “X-Spam-Status” “^Yes”) {
fileinto “Spam”;
stop;
}

It’s clear from the above that after a message is classified as Spam and moved to the Spam folder, any further sieve rules are not processed due to the stop directive. So removing that line should hopefully enable the Roundcube rules to be processed. I will test.

Hmm… It doesn’t work. I commented out the “stop” and ran:

sievec sieve-spam.sieve # Recompile the sieve filter
chown mail:dovecot sieve-spam.svbin # Change owner back to original after recompiling
service dovecot restart # Restart dovecot just in case this is needed to pick up the newly modified filter (I’m not sure).

I tested this by sending spam test messages to myself with the string “XJSC4JDBQADN1.NSBN32IDNENGTUBE-STANDARD-ANTI-UBE-TEST-EMAILC.34X” in the body, which is designed specifically to test spam filters. The messages still went to spam despite a Roundcube filter to move them into the Inbox.

I’m not sure why it didn’t work.

This pretty much has to be a client that is doing this. I’m not aware of anything running on MiaB after the message is delivered. You aren’t going to be able to fix that at the server level without preventing users from moving messages between folders.

No clients connected except Roundcube itself. I can’t explain it.

This topic was automatically closed 40 days after the last reply. New replies are no longer allowed.