Sieve removeflag Action

Stephan Bosch stephan at rename-it.nl
Fri Jan 13 12:50:25 UTC 2017



Op 13-1-2017 om 9:15 schreef Thomas Leuxner:
> Hi,
>
> I recently noticed that some of my automatically processed mails do no longer show flags with current Dovecot builds. This used to work before, not sure what broke it or whether I used it in the wrong way. When the removeflag line is dropped *both* messages get flagged in the client, one in INBOX and one in Trash. With removeflag in place, *both* messages are unflagged, the one in INBOX and the one in Trash. This used to work differently before if memory doesn't fail me.
>
> #Test
> if address :is "From" "user at example.com"
>          {
>          addflag "\\Flagged $MailFlagBit1";
>          keep;
>          removeflag "\\Flagged $MailFlagBit1";
>          fileinto "Trash";
>          }
>
> # 2.2.devel (01867a4): /etc/dovecot/dovecot.conf
> # Pigeonhole version 0.4.devel (3c071a4)
> # OS: Linux 3.16.0-4-amd64 x86_64 Debian 8.6

That should just work. I tested this with the indicated versions using 
sieve-test and an empty user account:

$ sieve-test -e -t - -Tlevel=matching ~/frop.sieve ~/message.eml

       ## Started executing script 'frop'
    6: address test
    6:   starting `:is' match with `i;ascii-casemap' comparator:
    6:   extracting `From' headers from message
    6:   parsing address header value `User <user at example.com>'
    6:   extracting `all' part from address `user at example.com'
    6:   matching value `user at example.com'
    6:     with key `user at example.com' => 1
    6:   finishing match with result: matched
    6: jump if result is false
    6:   not jumping
    8: addflag command
    8:   add flags `\Flagged $MailFlagBit1'
    9: keep action; store message in default mailbox
   10: removeflag command
   10:   remove flags `\Flagged $MailFlagBit1'
   11: fileinto action
   11:   store message in mailbox `Trash'
       ## Finished executing script 'frop'

info: msgid=unspecified: stored mail into mailbox 'INBOX'.
info: msgid=unspecified: stored mail into mailbox 'Trash'.
sieve-test(stephan): Info: final result: success
$ doveadm fetch flags mailbox "Trash" 1
flags: \Recent
$ doveadm fetch flags mailbox "INBOX" 1
flags: \Flagged \Recent $MailFlagBit1

So, that performs as expected. However, when I test this with LDA, Í can 
reproduce your problem:

$ doveadm fetch flags mailbox "Trash" 1
flags: \Recent
$ doveadm fetch flags mailbox "INBOX" 1
flags: \Recent

Will investigate more later today...

Regards,

Stephan.


More information about the dovecot mailing list