Hi, we're running Doveocot 2.3.4.1 with Pigeonhole, from repo.webflow.org. As far as I understand the RFC for 'fileinto', the following Sieve script should move a message either into the folder "SPAM" or "MaybeSPAM": require ["fileinto"]; # rule:[SPAM] if header :contains "subject" "SPAMSPAM" { fileinto "SPAM"; } # rule:[SPAMSPAM] if header :contains "subject" "SPAM" { fileinto "MaybeSPAM"; } But when I receive a message with subject "SPAMSPAM", the message turns up in "SPAM" and "MaybeSPAM". Is this expected behaviour? Thanks! Michael -- Michael Goth .webflow GmbH Gesch?ftsf?hrer: Andreas Schrei Wasserburger Stra?e 4 D - 83352 Altenmarkt a. d. Alz Amtsgericht Traunstein HRB 18537 E-Mail: mg at webflow.de Tel: +49 (0) 8621 - 99989 - 26 Fax: +49 (0) 8621 - 99989 - 28 Web: www.webflow.de
Helmut K. C. Tessarek
2019-Mar-07 07:57 UTC
Sieve fileinto copies messages instead of moving them
On 2019-03-07 02:52, Michael Goth via dovecot wrote:> require ["fileinto"]; > # rule:[SPAM] > if header :contains "subject" "SPAMSPAM" > { > ????fileinto "SPAM"; > } > # rule:[SPAMSPAM] > if header :contains "subject" "SPAM" > { > ????fileinto "MaybeSPAM"; > } > > > But when I receive a message with subject "SPAMSPAM", the message turns up in > "SPAM" and "MaybeSPAM". Is this expected behaviour?You are missing a stop after the fileinto. Otherwise it will not stop, but rather processing the next rule as well. Change it to: require ["fileinto"]; # rule:[SPAM] if header :contains "subject" "SPAMSPAM" { fileinto "SPAM"; stop; } # rule:[SPAMSPAM] if header :contains "subject" "SPAM" { fileinto "MaybeSPAM"; stop; } Cheers, K. C. -- regards Helmut K. C. Tessarek KeyID 0x172380A011EF4944 Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944 /* Thou shalt not follow the NULL pointer for chaos and madness await thee at its end. */ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: <https://dovecot.org/pipermail/dovecot/attachments/20190307/64bee442/attachment.sig>
Dauser Martin Johannes
2019-Mar-07 13:16 UTC
Sieve fileinto copies messages instead of moving them
Micheal, just for your information: "stop;" stops the whole script at this very line, which means no other rule will be applied on this message anymore. Most of the time this is desired. Otherwise "elsif" (and "else" as a catch-all) is your friend. require ["fileinto"]; # rule:[check if either SPAM or SPAMSPAM] if header :contains "subject" "SPAMSPAM" { ????fileinto "SPAM"; } elsif header :contains "subject" "SPAM" { ????fileinto "MaybeSPAM"; } # rule:[something else needs to be done with message] if blah { action; } On Thu, 2019-03-07 at 02:57 -0500, Helmut K. C. Tessarek via dovecot wrote:> You are missing a stop after the fileinto. Otherwise it will not stop, but > rather processing the next rule as well. > > Change it to: > > require ["fileinto"]; > # rule:[SPAM] > if header :contains "subject" "SPAMSPAM" > { > fileinto "SPAM"; > stop; > } > # rule:[SPAMSPAM] > if header :contains "subject" "SPAM" > { > fileinto "MaybeSPAM"; > stop; > } > > Cheers, > K. C. >