[Dovecot] Pigeonhole Sieve SetFlag question

Stephan Bosch stephan at rename-it.nl
Fri Jul 6 18:21:46 EEST 2012


Op 7/6/2012 5:10 PM, e-frog schreef:
> On 06.07.2012 16:46, wrote Vyacheslav Biruk:
>
>> But when I use following script - the flag is not set in \Seen
>>
>> require ["fileinto","imap4flags"];
>>
>> # rule:[test]
>> if anyof (header :contains "Subject" "test")
>> {
>>          fileinto "INBOX.SPAM";
>>          setflag "\\Seen";
>>          stop;
>> }
>
> This works for me...
>
> if anyof (header :contains "Subject" "test")
> {
>         addflag "\\Seen";
>     fileinto "INBOX.SPAM";
>         stop;
> }

Short story: put addflag/setflag/removeflag commands always before the 
fileinto command you want to affect.

Long story: in this form, the addflag command manipulates an internal 
variable that keeps record of the active flags. Once the fileinto 
command is used, the status of that variable is used to set flags for 
the stored message. Manipulating the active flags after storing the 
message with fileinto has no effect on that command anymore. Only 
subsequent other fileinto commands will notice the change. Read RFC5232 
(http://tools.ietf.org/html/rfc5232) for more info.

Regards,

Stephan.





More information about the dovecot mailing list