Can't discard spam messages on arrival using Sieve filters
-
FWIW, I've tried with a general "discard all" after the redirect, but still no-dice which is why I'm certain this is to do with some rule taking a higher priority when it comes to messages marked as spam.
# rule:[Discard messages after redirect complete] if true { discard; }
So in my case, the full Sieve file looks like this right now, but still not working to remove any spam messages:
# rule:[Redirect non-spam messages] if allof (not header :contains "x-spam-status" "Yes") { redirect "<clientExternalEmailAddress>"; } # rule:[Discard messages after redirect complete] if true { discard; }
-
@robi oh okay, so you’re saying to make a rule that tells all incoming mail to go to a particular new folder then run the other sieve filters on that new folder? I can try later I guess, I’m doubtful that’ll work because that’s kind of the issue… whatever exists that makes spam go to the Spam folder is overwriting everything else, basically completely bypassing Sieve filters. I’ll try when I can though (likely next week, I’m going to be away for the next few days after tomorrow).
-
@d19dotca Just got around to looking into this. This doesn't work because the mail server processes spam messages using dovecot's
sieve_before
flag - https://doc.dovecot.org/settings/pigeonhole/#plugin-sieve-setting-sieve-before . You can check the/app/dovecot-config/sieve_before/spam-move.sieve
script in the mail container which is moving X-Spam-Flag into the Spam folder. Because the filter below is run before user messages, your filters don't work. This also makes it easy for the end user to not worry about processing spam messages when writing filters, so I think the default behavior is good.require ["fileinto","mailbox"]; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; stop; }
For the original use case of discarding all spam for forwarding mailboxes, this is the default behavior in next release.
-
@girish said in Can't discard spam messages on arrival using Sieve filters:
so I think the default behavior is good.
As a default I think so too, but whilst the spam protection in Cloudron is reliable, sometimes the end user wants / needs to be able to filter spam messages directly It would therefore be good to have a simple way of filtering mails to discard spam selectively rather than just having all SPAM go to the SPAM folder. Mails with a SPAMASSASSIN score of over 20, for example, do not need to be saved anywhere, but those with a score of 7 or 8 could in theory be false positives so would warrant 'quarantining' rather than discarding altogether. The same applies to certain sender addresses and subjects.
This does not need to be something defined in webmail clients per domain, but could be a server-wide setting similar to the custom spamassassin rules.
-
@girish said in Can't discard spam messages on arrival using Sieve filters:
For the original use case of discarding all spam for forwarding mailboxes, this is the default behavior in next release.
Do you mind just expanding on this a bit more? What is a "forwarding mailbox" in your terms? Are you referring to the other feature request I had about mailing lists having an option to not forward messages identified as spam? If so, that's great! But now I will have to go back to the mailing list functionality I had moved away from a couple weeks ago, haha, but that's all good. If I've misunderstood what you mean by "forwarding mailbox" though, please clarify.
-
Any update on this? Ideally it would be nice to be able to define a custom spam assassin rule to instantly discard mails with certain criteria. I see persistent SPAM in the event log with easily identifiable criteria I would like to discard before it hits a mailbox but at the moment all I can do is give it a score of 100 so it is always marked as SPAM.
Whilst we can prevent mailservers with specific IPs or ranges from delivering mails via the firwall, this does not work for hostnames. That would be another way of stopping persistent spamming domains.
-
-