Hi! I have a config like this (globalsieverc): require "fileinto"; if address :domain :is "to" "domain.de" { if header :matches "X-Spam-Level" "\\*\\*\\*\\*\\*\\*\\*\\*" { #discard; fileinto "spamdir"; } } else { # The rest goes into INBOX # default is "implicit keep", we do it explicitly here keep; } It should filter all Mail for "domain.de" and then look for spam score.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, 10 Mar 2008, Sven Schmidt wrote:> I have a config like this (globalsieverc): > require "fileinto"; > if address :domain :is "to" "domain.de" { > if header :matches "X-Spam-Level" "\\*\\*\\*\\*\\*\\*\\*\\*" { > #discard; > fileinto "spamdir"; > } > } > else { > # The rest goes into INBOX > # default is "implicit keep", we do it explicitly here > keep; > }I guess, this is just a simplification of you real filter, therefore one remard: keep is not reached, if address matches, but header not. === The regex does not look correct, use just one backslash per asterisk. BTW: I would use header :contains "X-Spam-Level" "*****" Bye, - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH1moSVJMDrex4hCIRAuUzAJsGlUUts80v1TxtrGv69JCCUzDBBQCfQuQB l4U+oTgWC7sVeeS1clUw+VM=GBDx -----END PGP SIGNATURE-----
Chris Vogel
2008-Mar-11 13:23 UTC
[Dovecot] Test utility for sieve filters? (Re: Sieve doesnt filter)
Hey everybody, I had a similar problem with a sieve filter lately and was desperatly looking for a tool to test my filter conditions. In the end I used 'exim -d -bf', which works quiet well, but does not interpret sieve the same way the deliver plugin does (probably different sieve version). Is there a tool to test sieve filters, which behaves like the deliver plugin and writes a lot of output about the way it interprets the single commands and conditions? Chris.
Hello Sven, Monday, March 10, 2008, 5:17:58 PM, you wrote:> require "fileinto"; > if address :domain :is "to" "domain.de" { > if header :matches "X-Spam-Level" "\\*\\*\\*\\*\\*\\*\\*\\*" { > #discard; > fileinto "spamdir"; > } > }I vaguely remembers having problems with using regular expressions; how about using ":contains" instead of ":matches"? For the record, here's a .dovecot.sieve for one of my accounts: --------------------------------------------------------------------- require ["fileinto", "imapflags"]; if header :contains "X-Spam-Checked-By" "myhostid" { if header :contains "X-Spam-Level" "******" { if header :contains "X-Spam-Level" "********" { setflag "\\Seen"; } fileinto "Junk"; stop; } } elsif allof ( header :contains "Subject" "Undelivered Mail Returned To Sender", address :is "From" "MAILER-DAEMON at myhostname" ) { fileinto "INBOX.Undelivered"; } else { keep; } --------------------------------------------------------------------- -- Best regards, Robert Tomanek dovecot at mail.robert.tomanek.org
Steffen Kaiser schrieb:> I guess, this is just a simplification of you real filter, therefore > one remard: > > keep is not reached, if address matches, but header not. > > ===> > The regex does not look correct, use just one backslash per asterisk. > > BTW: I would use > > header :contains "X-Spam-Level" "*****" > > Bye,After a little more trying, I found the target mailbox. But now I want to copy a mail not move a mail, it is possible?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wed, 12 Mar 2008, Sven Schmidt wrote:> But now I want to copy a mail not move a mail, it is possible?Nope. - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH1723VJMDrex4hCIRAtoSAJ980NlqUHyVdH3ZgHScyBJz9WAXnQCfe55F JTdP2GOcOqiBaAywxh9BrkA=UQS3 -----END PGP SIGNATURE-----
Reasonably Related Threads
- How does one mark all messages as read (imap4flag "seen") with sieve?
- Deliver mail as 'read'?
- Spamassassin + Postfix : delete spam mail on the server ?
- How does one mark all messages as read (imap4flag "seen") with sieve?
- Spamassassin + Postfix : delete spam mail on the server ?