Sieve Rule: What am I missing here?

Larry Rosenman larryrtx at gmail.com
Thu Apr 30 21:04:24 UTC 2015


Thanks!  -- I figured it was stupid stuff but my head was spinning.
Appreciate the help!

On Thu, Apr 30, 2015 at 4:00 PM, Stephan Bosch <stephan at rename-it.nl> wrote:

> On 4/30/2015 9:15 PM, Larry Rosenman wrote:
> > I have a rule that sends all mail from root to a mailbox, but I want it
> to
> > NOT send mail from mailing-lists there.
> >
> > if allof (address :contains :localpart "From" "root",
> >           not anyof(exists ["List-Id","List-ID","Mailing-List",
> >                     "X-List-Name","List-Post"]))
> > {
> >    fileinto "root-mail";
> >    stop;
> > }
> >
> >
> > What am I missing in the AnyOf part?  Or am I totally messed up?
>
> A trace of the script shows the following for the provided example message:
>
> "
> $ sieve-test -t - -Tlevel=matching  ~/script.sieve ~/message.eml
>
>       ## Started executing script 'script'
>    3: address test
>    3:   starting `:contains' match with `i;ascii-casemap' comparator:
>    3:   extracting `From' headers from message
>    3:   parsing address header value `m.de.groot <m.de.groot at dmdg.nl>'
>    3:   extracting `localpart' part from address <m.de.groot at dmdg.nl>
>    3:   matching value `m.de.groot'
>    3:     with key `root' => 1
>    3:   finishing match with result: matched
>    3: jump if result is false
>    3:   not jumping
>    4: exists test
>    4:   header `List-Id' exists
>    4:   header `List-ID' exists
>    4:   header `Mailing-List' is missing
>    4:   headers are missing
>    5: jump if result is true
>    5:   not jumping
>    7: fileinto action
>    7:   store message in mailbox `root-mail'
>    8: stop command; end all script execution
>       ## Finished executing script 'frop'
>
> Performed actions:
>
>  * store message in folder: root-mail
>
> Implicit keep:
>
>   (none)
>
> sieve-test(stephan): Info: final result: success
> "
>
> So, the "exists" test returns false, because not all listed headers
> exist, which conforms to the specification:
>
> RFC 5228:
> "
> 5.5.  Test exists
>
>    Usage:   exists <header-names: string-list>
>
>    The "exists" test is true if the headers listed in the header-names
>    argument exist within the message.  All of the headers must exist or
>    the test is false.
> "
>
> Also, your use of "anyof" is useless. The following should work:
>
> "
> require "fileinto";
>
> if allof (address :contains :localpart "From" "root",
>     not anyof(
>         exists "List-Id",
>         exists "List-ID",
>         exists "Mailing-List",
>         exists "X-List-Name",
>         exists "List-Post"))
> {
>    fileinto "root-mail";
>    stop;
> }
> "
>
> Regards,
>
> Stephan.
>
>


-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 214-642-9640 (c)     E-Mail: larryrtx at gmail.com
US Mail: 108 Turvey Cove, Hutto, TX 78634-5688


More information about the dovecot mailing list