[Dovecot] Sieve: redirect and keep action, possible bug (solved, but curious)
Andreas Ntaflos
daff at dword.org
Sat Sep 26 04:49:27 EEST 2009
On Saturday 26 September 2009 02:40:40 Pascal Volk wrote:
> On 09/26/2009 02:27 AM Andreas Ntaflos wrote:
> > …
> > Funny thing is that it doesn't work here, even when I strip it down
> > to just the two lines:
> >
> > redirect "foo at example.org"
> > keep;
>
> Hm, sorry no idea what could be the reason for this behavior.
>
> > What version of Dovecot and Sieve are you using if I may ask?
>
> Tested with Dovecot v1.2.5 + Patch
> http://hg.dovecot.org/dovecot-1.2/rev/0f04c7da33f1 and Sieve from
> http://www.rename-it.nl/dovecot/1.2/dovecot-1.2-sieve-0.1.12.tar.gz
Thank you for confirming that it should work correctly with the latest
versions of Dovecot and Sieve. I found the problem in my setup.
I found that one of my "before" scripts (sieve_before =
/etc/dovecot/sieve/before.d, [1]) had a fileinto action together with an
explicit "keep". It seems that was a problem for the redirect action
later in the user's own script.
I modified that "before" script to use
fileinto :copy "INBOX/foo/bar";
instead of
fileinto "INBOX/foo/bar";
keep;
and now the redirect action works as expected, like you tested and
posted earlier.
Still, I wonder why this is happening? In both cases there is a keep
action in effect, otherwise the user's script wouldn't get executed at
all. Could someone explain what I am missing here? More details follow.
The script in /etc/dovecot/sieve/before.d looks as follows (I use it to
keep a backup copy of all mail received in an extra, hidden namespace):
001-backup-mails.sieve:
# We only want to backup incoming mail if it is not marked as spam.
if header :contains "X-Spam-Flag" ["YES"] {
discard;
stop;
} else {
# This works
fileinto :copy :flags "\\Seen" "Backup/received-backup";
# This doesn't, as explained above
# fileinto :flags "\\Seen" "Backup/received-backup";
# keep;
}
This user's script is again only two lines:
user.sieve:
redirect "foo at example.org"
keep;
As explained, in the user's sieve script the "keep" after the redirect
action is ignored when the backup mails script uses an explicit "keep"
after "fileinto", but not when "fileinto" is used with "copy".
Why?
Thanks,
Andreas
[1] http://wiki.dovecot.org/LDA/Sieve/Dovecot
--
Andreas Ntaflos
Vienna, Austria
GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC 7E65 397C E2A8 090C A9B4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://dovecot.org/pipermail/dovecot/attachments/20090926/5881d58d/attachment.bin
More information about the dovecot
mailing list