Filter (sieve) working only approximately half the time
I'm getting some spam on a recipient mail address ("name+companyname@mydomain.com", used before aliases were introduced.
I created a sieve filter to remove them automatically. I don't want them in my spam box. To start and to test it, I made it to only apply a label and decided when it works correctly, to let it delete emails.
But I noticed it works only about half the time. About half the mails I get on this recipient email address have the label, the other half don't.
The filter is:
require ["include", "environment", "variables", "relational", "comparator-i;ascii-numeric", "spamtest"];
require ["fileinto", "imap4flags"];
# Generated: Do not run this script on spam messages
#if allof (environment :matches "vnd.proton.spam-threshold" "*", spamtest :value "ge" :comparator "i;ascii-numeric" "${1}") {
# return;
#}
/**
* @type or
* @comparator ends
*/
if anyof (address :all :comparator "i;unicode-casemap" :matches ["To", "Cc", "Bcc"] ["*name+companyname@mydomain.com", "*name+companyname@mydomain.com", "*name+companyname@mydomain.com", "*name+companyname@mydomain.com", "*name+companyname@mydomain.com", "*name+companyname@mydomain.com"]) {
fileinto "spam";
fileinto "CompanyName leak";
addflag "\\Seen";
keep;
}
I had made it initially by creating a normal filter and converting to a sieve filter, so I could remove/comment out the "don't match spam" part of it).
When inspecting the headers, I don't notice anything that sets the matched and not-matched mails apart. They have the same To and X-Original-To, and nothing else is really significantly different.
Any ideas what may be up with this? How I could troubleshoot or fix?
Otherwise I'll just create a support ticket.