Sieve removeflag Action
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@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
Regards Thomas
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Fri, 13 Jan 2017, Thomas Leuxner wrote:
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@example.com" { addflag "\\Flagged $MailFlagBit1"; keep; removeflag "\\Flagged $MailFlagBit1"; fileinto "Trash"; }
from point of "logic" I would turn around both actions:
removeflag "\\Flagged $MailFlagBit1"; fileinto "Trash";
addflag "\\Flagged $MailFlagBit1"; keep;
Because keep is an action at the end of script processing, so the removeflag superceeds the "add". Or use fileinto "INBOX";
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1
iQEVAwUBWHiimXz1H7kL/d9rAQJJWggAnF/VfdP4LYIuH4eSG7Pzvu0iwYA4WHQ2 2aJzFzVmtnCNgidJ/SvN6CJ5VLF0K+SjbDT7/VmSV9tOaMjTh1cWqGe5jbJMhgBu emeHd6sy/XrVYqIhHeLadQGmR4pzT9SQo4Z/6rI5oDzhEhyZC8kXuxOqbtOtUOmr XyHorah814gxKDHzoTbbTZXeTRa7sCjy0gon60qBWEPEuom2mzyCGIPznLAmme7q YTfZWEfgfhuN4K6ENn0AJl/BAvpYQW2jUUH+My0ZykwDzqPPkOkOvmPiI/1yG0CB p34jJrM8f+z3CErWeg+sNXtCvQbjMUVtLRoWjy50ARGs+WekqYzezQ== =3vQF -----END PGP SIGNATURE-----
- Steffen Kaiser <skdovecot@smail.inf.fh-brs.de> 2017.01.13 10:49:
from point of "logic" I would turn around both actions:
removeflag "\\Flagged $MailFlagBit1"; fileinto "Trash";
addflag "\\Flagged $MailFlagBit1"; keep;
Hi Steffen,
that works thanks. Not sure why it worked before.
Regards Thomas
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@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@example.com>'
6: extracting `all' part from address `user@example.com'
6: matching value `user@example.com'
6: with key `user@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.
- Stephan Bosch <stephan@rename-it.nl> 2017.01.13 13:50:
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...
Thanks for confirming Stephan.
Op 1/13/2017 om 2:22 PM schreef Thomas Leuxner:
- Stephan Bosch <stephan@rename-it.nl> 2017.01.13 13:50:
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... Thanks for confirming Stephan.
Fixed:
https://github.com/dovecot/pigeonhole/commit/772485538302957ebada484b6eedec5...
Regards,
Stephan.
- Stephan Bosch <stephan@rename-it.nl> 2017.01.14 12:35:
Fixed:
https://github.com/dovecot/pigeonhole/commit/772485538302957ebada484b6eedec5...
Regards,
Stephan.
Confirmed effective. Thanks!
I guess I should pick this up for the FreeBSD port :) -- will do.
On 1/14/17, Thomas Leuxner <tlx@leuxner.net> wrote:
- Stephan Bosch <stephan@rename-it.nl> 2017.01.14 12:35:
Fixed:
https://github.com/dovecot/pigeonhole/commit/772485538302957ebada484b6eedec5...
Regards,
Stephan.
Confirmed effective. Thanks!
-- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 214-642-9640 (c) E-Mail: larryrtx@gmail.com US Mail: 17716 Limpia Crk, Round Rock, TX 78664-7281
- Stephan Bosch <stephan@rename-it.nl> 2017.01.14 12:35:
Fixed:
https://github.com/dovecot/pigeonhole/commit/772485538302957ebada484b6eedec5...
Hi Stephan,
I recently noticed that the 'flags' still cause issues when using an _include_ script like:
require ["include","copy","fileinto","imap4flags","vacation"]; include :global "global";
In this case the file options work fine, but the flags are not set.
Regards Thomas
Op 1/19/2017 om 10:07 AM schreef Thomas Leuxner:
- Stephan Bosch <stephan@rename-it.nl> 2017.01.14 12:35:
Fixed:
https://github.com/dovecot/pigeonhole/commit/772485538302957ebada484b6eedec5... Hi Stephan,
I recently noticed that the 'flags' still cause issues when using an _include_ script like:
require ["include","copy","fileinto","imap4flags","vacation"]; include :global "global";
In this case the file options work fine, but the flags are not set.
Could you provide a more detailed example?
Regards,
Stephan.
- Stephan Bosch <stephan@rename-it.nl> 2017.01.19 10:32:
Could you provide a more detailed example?
Sure. Personal script v
/var/vmail/domains/leuxner.net/tlx/.dovecot.sieve:
require ["include","copy","fileinto","imap4flags","vacation"]; include :global "global";
--
Global script referenced v
/var/vmail/conf.d/leuxner.net/sieve/global.sieve:
require ["fileinto","imap4flags","duplicate"];
#Newsletters
if header :contains "List-Id" "debian-security-announce.lists.debian.org" { removeflag "\\Flagged $MailFlagBit1"; fileinto ":public/Newsletters/Debian/Security"; addflag "\\Flagged $MailFlagBit1"; keep; }
-- Basically it is reproducible with the same stanza we used before by putting this in the included script:
#Test if address :is "From" "user@example.com" { removeflag "\\Flagged $MailFlagBit1"; fileinto "Trash"; addflag "\\Flagged $MailFlagBit1"; keep; }
Regards Thomas
Op 19-1-2017 om 10:43 schreef Thomas Leuxner:
- Stephan Bosch <stephan@rename-it.nl> 2017.01.19 10:32:
Could you provide a more detailed example? Sure. Personal script v
/var/vmail/domains/leuxner.net/tlx/.dovecot.sieve:
require ["include","copy","fileinto","imap4flags","vacation"]; include :global "global";
--
Global script referenced v
/var/vmail/conf.d/leuxner.net/sieve/global.sieve:
require ["fileinto","imap4flags","duplicate"];
#Newsletters
if header :contains "List-Id" "debian-security-announce.lists.debian.org" { removeflag "\\Flagged $MailFlagBit1"; fileinto ":public/Newsletters/Debian/Security"; addflag "\\Flagged $MailFlagBit1"; keep; }
-- Basically it is reproducible with the same stanza we used before by putting this in the included script:
#Test if address :is "From" "user@example.com" { removeflag "\\Flagged $MailFlagBit1"; fileinto "Trash"; addflag "\\Flagged $MailFlagBit1"; keep; }
Couldn't reproduce this with v2.3.devel yesterday (i.e. no flags set for the Security mailbox and all flags set for the message in INBOX), but I will try later with some older version.
Regards,
Stephan.
- Stephan Bosch <stephan@rename-it.nl> 2017.02.17 14:34:
Couldn't reproduce this with v2.3.devel yesterday (i.e. no flags set for the Security mailbox and all flags set for the message in INBOX), but I will try later with some older version.
I did install a newer build this morning:
Feb 20 07:00:23 nihlus dovecot: master: Dovecot v2.2.devel (8f42a89) starting up for imap, lmtp
This one processed the dovecot-news mail for 2.2.28.rc1 fine which uses a similar sieve rule. I will monitor global rules with this build and report back.
Regards Thomas
- Thomas Leuxner <tlx@leuxner.net> 2017.02.20 12:56:
Feb 20 07:00:23 nihlus dovecot: master: Dovecot v2.2.devel (8f42a89) starting up for imap, lmtp
This one processed the dovecot-news mail for 2.2.28.rc1 fine which uses a similar sieve rule. I will monitor global rules with this build and report back.
The results seem to be arbitrary. Personal rules _always_ work for flag actions, global rules included do _sometimes_. This means one day the same rule may trigger, the next day it won't. I found no way to reproduce it for global rules in order to narrow down the issue.
Regards Thomas
Op 2/22/2017 om 8:40 PM schreef Thomas Leuxner:
- Thomas Leuxner <tlx@leuxner.net> 2017.02.20 12:56:
Feb 20 07:00:23 nihlus dovecot: master: Dovecot v2.2.devel (8f42a89) starting up for imap, lmtp
This one processed the dovecot-news mail for 2.2.28.rc1 fine which uses a similar sieve rule. I will monitor global rules with this build and report back. The results seem to be arbitrary. Personal rules _always_ work for flag actions, global rules included do _sometimes_. This means one day the same rule may trigger, the next day it won't. I found no way to reproduce it for global rules in order to narrow down the issue.
Could you show me your full configuration (dovecot -n
)?
Regards,
Stephan
Op 2/24/2017 om 10:30 AM schreef Thomas Leuxner:
- Stephan Bosch <stephan@rename-it.nl> 2017.02.24 10:20:
Could you show me your full configuration (
dovecot -n
)?Regards,
Stephan Live configuration and scripts sent off-list.
Tried this with your full scripts, part of your public mailbox configuration and this test message:
From: User <user@example.com> To: stephan@rename-it.nl Subject: Frop! List-Id: <debian-security-announce.lists.debian.org>
Frop!
Tried manual delivery several times, with equal results:
stephan@drieka:~$ /usr/lib/dovecot/dovecot-lda -p ~/message.eml stephan@drieka:~$ doveadm -f table fetch "uid flags" mailbox ":public/Newsletters/Debian/Security" uid flags 1 \Recent 2 \Recent 3 \Recent stephan@drieka:~$ doveadm -f table fetch "uid flags" mailbox "INBOX" uid flags 14 \Flagged \Recent $MailFlagBit1 15 \Flagged \Recent $MailFlagBit1 16 \Flagged \Recent $MailFlagBit1
So, I cannot reproduce your problem.
Could you try this at your end?
Regards,
Stephan.
participants (4)
-
Larry Rosenman
-
Steffen Kaiser
-
Stephan Bosch
-
Thomas Leuxner