Re: sieve question

[email protected] Mon, 06 Jul 2026 20:50:14 +0200
Newsgroups gmane.linux.suse.general
Message-ID <[email protected]>
On Donnerstag, 2. Juli 2026 20:40:33 Mitteleuropäische Sommerzeit [email protected] wrote:
> Hi,
> 
> does anyone have any idea, what might be wrong with
> 
>   if anyof(
>     # either: header :regex "Subject" "\\s+VUL\-[0-9]:\\s+"
>     # or:
>     header :contains "Subject" "VUL.0"
>   ) {
>     fileinto :create "Mailarchiv/nach Themen/Computer & Elektronik - System - linux - opensuse - bugs-vul";
>   } else {
>     fileinto :create "Mailarchiv/nach Themen/Computer & Elektronik - System - linux - opensuse - bugs";
>   }
> 
> in my sieve script?
> It always gets to the else branch, when I get a mail from the bug list.
> If I copy the Subject line from the file in my dovecot maildir and send a mail manually with this subject it works as expected - the mail will be filed into bugs-vul.

I found the problem - and as is so often the case, it was PEBKAC.

What I had was:

...
elsif anyof (
  header :regex "List-Id" "<([^.]+)\.lists\.opensuse\.org>$"
) {
  addheader :last "X-Sieve-List" "${1}";
  if anyof(
    header :is "To" "opensuse@<mydomain1>"
  ) {
    fileinto :create "Mailarchiv/nach Themen/Computer & Elektronik - System - linux - opensuse - mh";
  }
  fileinto :create "Mailarchiv/nach Themen/Computer & Elektronik - System - linux - opensuse - ${1}";
}
elsif anyof (
  header "From" "[email protected]"
) {
  addheader :last "X-Sieve-List" "bugs";
  if anyof(
    header :is "To" "opensuse@<mydomain1>"
  ) {
    fileinto :create "Mailarchiv/nach Themen/Computer & Elektronik - System - linux - opensuse - mh";
  }
  if allof(
    header :regex "Subject" "\\s+VUL\-[0-9]:\\s+"
  ) {
    fileinto :create "Mailarchiv/nach Themen/Computer & Elektronik - System - linux - opensuse - bugs-vul";
  } else {
    fileinto :create "Mailarchiv/nach Themen/Computer & Elektronik - System - linux - opensuse - bugs";
  }
}
...

So the more general rule always caught the mail, the second one was never reached.
I never recognized that, before I added the "bug-vul" branch to the second rule, and no mail was filed into "bugs-vul".
Switching these two rules solved the problem.

Bye.
Michael.
smime.p7s (application/pkcs7-signature, 3.9 KB) - not displayed