Dear list, I want to define two concurrent rules : 1. I want to flag an e-mail containing the word "cloud" in the body 2. I want to move mail sent explicitly to me (as opposed to mail sent to an alias I am part of) going to "INOBX.I must answere this"
If I put rule (1) first, everything works as expected. If put rule (2) first, only that rule applies. Here's a small test case you should be able to reproduce on your setup. Let's work on this fake test e-mail : $ cat testmail.eml Date: Mon, 28 May 2018 12:41:53 +0100 From: fri...@otherdomain.tld To: m...@mydomain.tld Subject: dur dur la vie mon frère, le cloud c'est le top du top Here's the first, broken version of the script $ cat test.sieve require ["body","fileinto","imap4flags","vacation"]; # rule:[Mail about me] if anyof (header :contains "to" "m...@mydomain.tld", body :text :contains "ahmed") { fileinto "INBOX.I must answere this"; } # rule:[Mail about the Cloud] if body :text :contains "cloud" { addflag "\\Flagged"; } Let's test it out, the two rules should be applied : $ sieve-test test.sieve testmail.eml Performed actions: * store message in folder: INBOX.I must answere Implicit keep: (none) sieve-test(root): Info: final result: success $ Notice that the last rule isn't applied although it matches. Now we invert the order of the rules and apply the script on the same test e-mail : $ cat test.sieve require ["body","fileinto","imap4flags","vacation"]; # rule:[Mail about the Cloud] if body :text :contains "cloud" { addflag "\\Flagged"; } # rule:[Mail about me] if anyof (header :contains "to" "m...@mydomain.tld", body :text :contains "ahmed") { fileinto "INBOX.I must answere this"; } Running the test again : $ sieve-test test.sieve testmail.eml Performed actions: * store message in folder: INBOX.I must answere + add IMAP flags: \flagged Implicit keep: (none) sieve-test(root): Info: final result: success $ The IMAP flag was set ! Any ideas ?