Sieve Rule: What am I missing here?
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; }
I got a mail with the following headers: Return-Path: <openssl-users-bounces@openssl.org> Delivered-To: ler@lerctr.org Received: from thebighonker.lerctr.org by thebighonker.lerctr.org (Dovecot) with LMTP id gt09JVp6QlUfkQAAu+mOrA for <ler@lerctr.org>; Thu, 30 Apr 2015 13:54:29 -0500 Received: from mta.openssl.org ([194.97.150.230]:56641) by thebighonker.lerctr.org with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85 (FreeBSD)) (envelope-from <openssl-users-bounces@openssl.org>) id 1YntbO-0009fK-Em for ler@lerctr.org; Thu, 30 Apr 2015 13:54:29 -0500 Received: from mta.openssl.org (localhost [127.0.0.1]) by mta.openssl.org (Postfix) with ESMTP id F3DF4204AE; Thu, 30 Apr 2015 18:54:11 +0000 (UTC) X-Original-To: openssl-users@mta.openssl.org Delivered-To: openssl-users@mta.openssl.org Received: by mta.openssl.org (Postfix, from userid 106) id 9D98B204AE; Thu, 30 Apr 2015 18:54:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mta.openssl.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 X-Greylist: delayed 471 seconds by postgrey-1.34 at mta; Thu, 30 Apr 2015 18:54:10 UTC Received: from mtx6.mbn1.net (mtx6.mbn1.net [213.188.129.253]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mta.openssl.org (Postfix) with ESMTPS id 51E1920135 for <openssl-users@openssl.org>; Thu, 30 Apr 2015 18:54:10 +0000 (UTC) From: m.de.groot <m.de.groot@dmdg.nl> To: "openssl-users@openssl.org" <openssl-users@openssl.org> Date: Thu, 30 Apr 2015 20:46:11 +0200 Thread-Topic: Error signing document Thread-Index: AQHQg3XtdOOD1R0meUuAevuEqgOClg== Message-ID: < E7206BA2D53D894BAD0C4B62B2C52E7722E3CA8252@MBX01.hosting01.active24.com> Accept-Language: nl-NL, en-US Content-Language: nl-NL X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: nl-NL, en-US MIME-Version: 1.0 Subject: [openssl-users] Error signing document X-BeenThere: openssl-users@openssl.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <openssl-users.openssl.org> List-Unsubscribe: <https://mta.openssl.org/mailman/options/openssl-users>, <mailto:openssl-users-request@openssl.org?subject=unsubscribe> List-Archive: <http://mta.openssl.org/pipermail/openssl-users/> List-Post: <mailto:openssl-users@openssl.org> List-Help: <mailto:openssl-users-request@openssl.org?subject=help> List-Subscribe: <https://mta.openssl.org/mailman/listinfo/openssl-users>, <mailto:openssl-users-request@openssl.org?subject=subscribe> Reply-To: openssl-users@openssl.org Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Errors-To: openssl-users-bounces@openssl.org Sender: "openssl-users" <openssl-users-bounces@openssl.org> X-Spam-Score: -0.9 (/) X-LERCTR-Spam-Score: -0.9 (/) X-Spam-Report: SpamScore (-0.9/5.0) BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.001,KAM_LAZY_DOMAIN_SECURITY=1,RCVD_IN_MSPIKE_H3=-0.01,RCVD_IN_MSPIKE_WL=-0.01,T_RP_MATCHES_RCVD=-0.01 X-LERCTR-Spam-Report: SpamScore (-0.9/5.0) BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.001,KAM_LAZY_DOMAIN_SECURITY=1,RCVD_IN_MSPIKE_H3=-0.01,RCVD_IN_MSPIKE_WL=-0.01,T_RP_MATCHES_RCVD=-0.01
What am I missing in the AnyOf part? Or am I totally messed up?
-- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 214-642-9640 (c) E-Mail: larryrtx@gmail.com US Mail: 108 Turvey Cove, Hutto, TX 78634-5688
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@dmdg.nl>'
3: extracting localpart' part from address <m.de.groot@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.
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@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: extractingFrom' headers from message 3: parsing address header value
m.de.groot <m.de.groot@dmdg.nl>' 3: extractinglocalpart' part from address <m.de.groot@dmdg.nl> 3: matching value
m.de.groot' 3: with keyroot' => 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: headerList-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@gmail.com US Mail: 108 Turvey Cove, Hutto, TX 78634-5688
participants (2)
-
Larry Rosenman
-
Stephan Bosch