[Sieve] Understand Sieve processing

h8h
Fri, 26 Mar 2021 07:30:51 -0000

Hi,

I have the following configuration:

 > cat > /etc/dovecot/conf.d/99-local-sieve.conf << EOF;
 > plugin {
 >  sieve_before = /etc/dovecot/sieve-spam.sieve
 >  sieve_before2 = /mail/sieve/global_before
 >  sieve_after = /mail/sieve/global_after
 >  sieve = /mail/sieve/%d/%n.sieve
 >  sieve_dir = /mail/sieve/%d/%n
 > }
 > EOF

 > cat /etc/dovecot/sieve-spam.sieve
 > require ["regex", "fileinto", "imap4flags"];
 >
 > if allof (header :regex "X-Spam-Status" "^Yes") {
 >  fileinto "Spam";
 > }

(I removed the keyword "stop;" to proceed rule processing, which does
not work)


Now as a user (/mail/sieve/%d/%n.sieve) I want to create my own "Spam"
rule:
 > require ["regex","reject"];
 > # rule:[SPAM]
 > if allof (header :regex "x-spam-status" "^Yes")
 > {
 >        reject text:
 > This E-Mail is SPAM.
 > .
 > ;
 > }



I activate the traces and see the following if the e-mail is SPAM:

 >      ## Started executing script 'sieve-spam'
 >   3: jump if result is false
 >   3:   not jumping
 >   4: fileinto action
 >   4:   store message in mailbox `Spam'
 >      ## Finished executing script 'sieve-spam'


If the e-mail is not SPAM:
 >      ## Started executing script 'sieve-spam'
 >   3: jump if result is false
 >   3:   jumping to line 4
 >      ## Finished executing script 'sieve-spam'
 >
 >
 >      ## Started executing script 'roundcube'
 >   3: jump if result is false
 >   3:   jumping to line 10
 >      ## Finished executing script 'roundcube'

So my sieve gets only executed if the e-mail is not SPAM. Thats a bit odd.

Could you explain how the sieve processing work and how I can solve this
problem?

  dovecot --version
2.2.33.2 (d6601f4ec)
on Ubuntu 18.04 LTS

Best regards
Homy