[Dovecot] Problem with sieve. dovecot 2.0.17
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@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@ngtech.co.il): Debug: sieve: executing script from /home/vmail/domain/eliezer/home/.dovecot.svbin Oct 23 17:12:26 lda(eliezer@test1.dom): Info: sieve: msgid=5086B3C9.5030909@test.dom: stored mail into mailbox 'INBOX' Oct 23 17:12:26 lda(eliezer@test1.dom): Info: sieve: msgid=5086B3C9.5030909@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
On Tue, Oct 23, 2012 at 05:19:04PM +0200, Eliezer Croitoru wrote:
[..]
the script is: require ["fileinto", "envelope"]; if envelope :is "from" "eliezer@test.dom" { fileinto "old";
stop; # seems to be needed with explicit keep
} else { # The rest goes into INBOX # default is "implicit keep", we do it explicitly here keep; }
Comparing various sieve scripts I concluded (but I didn't actually test it) that you need a stop; in your if or elsif clauses in case you have an else clause with an explicit keep; -- IMHO a behaviour violating RFC 5228.
RFC 5228, Section 3.1
...
If the test of the "if" is false, it evaluates the test of the
first "elsif" (if any). If the test of "elsif" is true, it
runs the elsif's block. An elsif may be followed by an elsif,
in which case, the interpreter repeats this process until it
runs out of elsifs.
When the interpreter runs out of elsifs, there may be an
"else" case. If there is, and none of the if or elsif tests
were true, the interpreter runs the else's block.
...
Stefan, can you enlighten us?
Dennis
[..]
On 10/23/2012 5:19 PM, 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@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@ngtech.co.il): Debug: sieve: executing script from /home/vmail/domain/eliezer/home/.dovecot.svbin Oct 23 17:12:26 lda(eliezer@test1.dom): Info: sieve: msgid=5086B3C9.5030909@test.dom: stored mail into mailbox 'INBOX' Oct 23 17:12:26 lda(eliezer@test1.dom): Info: sieve: msgid=5086B3C9.5030909@test.dom: stored mail into mailbox 'old'
from unknown reason(or I didnt understood how sieve works?)
This behavior would definitely be a bug, but I cannot reproduce it even with Dovecot 2.0.17 and Pigeonhole v0.2.5:
stephan@host:~/src/devel/dovecot-2.0-pigeonhole$ src/sieve-tools/sieve-test -t - -Tlevel=matching -e ~/frop.sieve ~/frop.eml
## Started executing script 'frop'
2: envelope test
2: starting `:is' match with `i;ascii-casemap' comparator:
2: getting `from' part from message envelope
2: extracting `all' part from address `eliezer@test.dom'
2: matching value `eliezer@test.dom'
2: with key `eliezer@test.dom' => 1
2: finishing match with result: matched
2: jump if result is false
2: not jumping
3: fileinto action
3: store message in mailbox `old'
3: jumping to line 7
## Finished executing script 'frop'
info: msgid=unspecified: stored mail into mailbox 'old'. sieve-test(stephan): Info: final result: success
Could you test this at your end? Be careful, the above command adds a message to the user's mailbox, so read the sieve-test man page first before you try anything. Also, I executed this from my development tree, because I haven't got an operational Dovecot v2.0 installation.
I don't remember any bug that was solved since that version that could explain what you're seeing. What is your Pigeonhole version? I've tried with v0.2.5 at this end.
Also, could you provide your full configuration as output from dovecot -n
?
Regards,
Stephan.
On 10/23/2012 9:40 PM, Stephan Bosch wrote:
Also, could you provide your full configuration as output from
dovecot -n
?Regards,
Stephan.
Thanks Stephan,
I just upgraded from 2.0.17 to 2.1.9 and ph 0.3.1 (gentoo) and it seems to work as expected and dont leave any traces in the INBOX with the same script. I dont know the old ph version and since it was resolved i'm ok with it. My only problem is that it will put the file in the folder but will not mark the folder with the new file until I actually check the folder manually. it's not that much hustle but if there is a way to solve it I will be more then happy to hear about it.
Thanks, Eliezer
Eliezer Croitoru https://www1.ngtech.co.il IT consulting for Nonprofit organizations eliezer <at> ngtech.co.il
On 10/25/2012 9:16 AM, Eliezer Croitoru wrote:
My only problem is that it will put the file in the folder but will not mark the folder with the new file until I actually check the folder manually. it's not that much hustle but if there is a way to solve it I will be more then happy to hear about it.
This is most likely a client problem. Have you configured your client to check that folder?
Regards,
Stephan.
On 10/27/2012 11:03 PM, Stephan Bosch wrote:
This is most likely a client problem. Have you configured your client to check that folder?
Yes unless there there is a special thing I dont know yet about in Thunderbird.
Thanks, Eliezer
Eliezer Croitoru https://www1.ngtech.co.il IT consulting for Nonprofit organizations eliezer <at> ngtech.co.il
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@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@ngtech.co.il): Debug: sieve: executing script from /home/vmail/domain/eliezer/home/.dovecot.svbin Oct 23 17:12:26 lda(eliezer@test1.dom): Info: sieve: msgid=5086B3C9.5030909@test.dom: stored mail into mailbox 'INBOX' Oct 23 17:12:26 lda(eliezer@test1.dom): Info: sieve: msgid=5086B3C9.5030909@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
participants (4)
-
Bill Shirley
-
Dennis Guhl
-
Eliezer Croitoru
-
Stephan Bosch