[Dovecot] Problem with sieve. dovecot 2.0.17

Bill Shirley
Wed, 24 Oct 2012 01:15:34 -0000

On 10/23/2012 11:19 AM, Eliezer Croitoru wrote:
> Since I have lots of filtering rules in thunderbird I was thinking of
> using sieve instead.
> I want to filter incoming mail into subdirectories.
> like "from" store at folder "old".
> the script is:
> require ["fileinto", "envelope"];
> if envelope :is "from" "eliezer at test.dom" {
>   fileinto "old";
> } else {
>   # The rest goes into INBOX
>   # default is "implicit keep", we do it explicitly here
>   keep;
> }
>
> the result is that the mail is stored in two folders instead of just
> one, INBOX and old.
> the logs shows:
> Oct 23 17:12:26 lda(eliezer at ngtech.co.il): Debug: sieve: executing
> script from /home/vmail/domain/eliezer/home/.dovecot.svbin
> Oct 23 17:12:26 lda(eliezer at test1.dom): Info: sieve:
> msgid=<5086B3C9.5030909 at test.dom>: stored mail into mailbox
'INBOX'
> Oct 23 17:12:26 lda(eliezer at test1.dom): Info: sieve:
> msgid=<5086B3C9.5030909 at test.dom>: stored mail into mailbox
'old'
>
> from unknown reason(or I didnt understood how sieve works?)
>
> plugin section from dovecot -n
>
> plugin {
> ...
>   sieve = ~/.dovecot.sieve
>   sieve_dir = ~/sieve
>   sieve_extensions = +vnd.dovecot.debug +imapflags +relational
> +comparator-i;ascii-numeric
> }
>
> Thanks,
> Eliezer
Why to people bother with all these complex if...elsif...else
structures.  I just use stop a lot.  This is included from my Main.seive:
#
# 2012-07-05
#
require "include";
require "fileinto";
require "copy";
#require "body";
#require "imap4flags";

# put this in main
#if header :contains "list-id" "dovecot.dovecot.org" {
include "Dovecot"; }

if address :is :localpart "to" "dovecot" {
   fileinto :copy "SystemFolders.Ham";
   fileinto "Lists.Dovecot";
   stop;
}

fileinto "Lists";
stop;

As you can see, I also train Spamassassin with the mail from the list.

Bill