This is what I use. Notice the comma: require "fileinto"; if header :contains "X-Spam-Status" "Yes," { fileinto "SystemFolders.SuspectedSpam"; stop; }
Bill
On 12/14/2017 1:02 PM, Richard wrote:
Date: Thursday, December 14, 2017 09:47:44 -0800 From: Gao gao@pztop.com
I use a sieve filter to move spam email to user's Junk folder: # cat spam_to_junk.sieve require "fileinto"; if exists "X-Spam-Status" { if header :contains "X-Spam-Status" "YES" { fileinto "Junk"; stop; } else { } } if header :contains "subject" ["SPAM?"] { fileinto "Junk"; stop; }
Most time this filter works fine but occasionally it move non-spam in to Junk folder. Here is an example, this email is from dovecot mailling list and it end up in my Junk folder. Mailllog and header here. Would someone help me to figure out what went wrong here?
Thanks.
Gao
X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00
Because of the way you are bounding it, I suspect that the "YES" in BAYES_00, at the end of that line, is triggering the mis-filing.
Why not make:
contains "X-Spam-Status" "YES"
a single string:
contains "X-Spam-Status: YES"
that would be more precise and avoid this issue.