[Dovecot] sieve rules processing
Nikita Koshikov
koshikov at gmail.com
Thu Jul 30 12:08:02 EEST 2009
On Thu, 30 Jul 2009 10:38:51 +0200
Stephan Bosch <stephan at rename-it.nl> wrote:
> Nikita Koshikov schreef:
> > On Thu, 30 Jul 2009 01:29:26 +0200
> > Stephan Bosch <stephan at rename-it.nl> wrote:
> >> I am not exactly sure what you mean. Why are you providing an explicit
> >> keep command when you want to sort the message further?
> > Without keep action - mail just redirected to specified mailbox, but it doesn't stores into my inbox.
> [..]
> > This is my current rule list:
> >
> > require ["fileinto","envelope","copy"];
> > # rule:[redirect]
> > if anyof (true)
> > {
> > redirect :copy "alice at domain.com";
> > }
> > # rule:[Cron]
> > elsif anyof (header :contains "Subject" "Cron")
> > {
> > fileinto "INBOX/Cron";
> > }
> >
> [..]
> > But this mail save into INBOX, for user koshikov.n at domain.com, (the second rule is not working), in logs I have:
> > Jul 30 10:29:04 deliver(koshikov.n at domain.com): Info: sieve: msgid=<4A714B09.9030704 at domain.com>: forwarded to <alice at domain.com>
> > Jul 30 10:29:04 deliver(koshikov.n at domain.com): Info: sieve: msgid=<4A714B09.9030704 at domain.com>: stored mail into mailbox 'INBOX'
> > Jul 30 10:29:04 deliver(alice at domain.com): Info: sieve: msgid=<4A714B09.9030704 at domain.com>: stored mail into mailbox 'INBOX'
> >
> > So :copy acting for me like "keep". Do you have any ideas, why this might happen ?
>
> Yes, your second rule is an elsif, meaning that it is only executed when
> the first if-condition is not 'true'. Since that first rule has a forced
> 'true' result, the second rule is absolutely never executed. You script
> should be:
>
> require ["fileinto","copy"];
>
> # rule:[redirect]
> if true
> {
> redirect :copy "alice at domain.com";
> }
>
> # rule:[Cron]
> if header :contains "Subject" "Cron"
> {
> fileinto "INBOX/Cron";
> }
>
> Note that the anyof() commands are only necessary when you have multiple
> tests per if command. Also, I removed the envelope require, since it is
> not used.
Thank you, Stephan.
Your example rules works like a charm.
>
> Regards,
>
> --
> Stephan Bosch
> stephan at rename-it.nl
More information about the dovecot
mailing list