Network Working Group                                       W. Segmuller
Request for Comments: 5231                                      B. Leiba
Obsoletes: 3431                          IBM T.J. Watson Research Center
Category: Standards Track                                   January 2008
        
Network Working Group                                       W. Segmuller
Request for Comments: 5231                                      B. Leiba
Obsoletes: 3431                          IBM T.J. Watson Research Center
Category: Standards Track                                   January 2008
        

Sieve Email Filtering: Relational Extension

筛选电子邮件过滤:关系扩展

Status of This Memo

关于下段备忘

This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.

本文件规定了互联网社区的互联网标准跟踪协议,并要求进行讨论和提出改进建议。有关本协议的标准化状态和状态,请参考当前版本的“互联网官方协议标准”(STD 1)。本备忘录的分发不受限制。

Abstract

摘要

This document describes the RELATIONAL extension to the Sieve mail filtering language defined in RFC 3028. This extension extends existing conditional tests in Sieve to allow relational operators. In addition to testing their content, it also allows for testing of the number of entities in header and envelope fields.

本文档描述RFC 3028中定义的筛邮件过滤语言的关系扩展。此扩展扩展扩展了Sieve中现有的条件测试,以允许使用关系运算符。除了测试其内容外,它还允许测试标头和信封字段中的实体数量。

This document obsoletes RFC 3431.

本文件淘汰RFC 3431。

Table of Contents

目录

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 2
   2.  Conventions Used in This Document . . . . . . . . . . . . . . . 2
   3.  Comparators . . . . . . . . . . . . . . . . . . . . . . . . . . 2
   4.  Match Types . . . . . . . . . . . . . . . . . . . . . . . . . . 3
     4.1.  Match Type VALUE  . . . . . . . . . . . . . . . . . . . . . 3
     4.2.  Match Type COUNT  . . . . . . . . . . . . . . . . . . . . . 3
   5.  Interaction with Other Sieve Actions  . . . . . . . . . . . . . 4
   6.  Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
   7.  Extended Example  . . . . . . . . . . . . . . . . . . . . . . . 6
   8.  Changes since RFC 3431  . . . . . . . . . . . . . . . . . . . . 6
   9.  IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 7
   10. Security Considerations . . . . . . . . . . . . . . . . . . . . 7
   11. Normative References  . . . . . . . . . . . . . . . . . . . . . 7
        
   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 2
   2.  Conventions Used in This Document . . . . . . . . . . . . . . . 2
   3.  Comparators . . . . . . . . . . . . . . . . . . . . . . . . . . 2
   4.  Match Types . . . . . . . . . . . . . . . . . . . . . . . . . . 3
     4.1.  Match Type VALUE  . . . . . . . . . . . . . . . . . . . . . 3
     4.2.  Match Type COUNT  . . . . . . . . . . . . . . . . . . . . . 3
   5.  Interaction with Other Sieve Actions  . . . . . . . . . . . . . 4
   6.  Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
   7.  Extended Example  . . . . . . . . . . . . . . . . . . . . . . . 6
   8.  Changes since RFC 3431  . . . . . . . . . . . . . . . . . . . . 6
   9.  IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 7
   10. Security Considerations . . . . . . . . . . . . . . . . . . . . 7
   11. Normative References  . . . . . . . . . . . . . . . . . . . . . 7
        
1. Introduction
1. 介绍

The RELATIONAL extension to the Sieve mail filtering language [Sieve] provides relational operators on the address, envelope, and header tests. This extension also provides a way of counting the entities in a message header or address field.

Sieve邮件过滤语言[Sieve]的关系扩展为地址、信封和头测试提供了关系运算符。此扩展还提供了一种对消息头或地址字段中的实体进行计数的方法。

With this extension, the Sieve script may now determine if a field is greater than or less than a value instead of just equivalent. One use is for the x-priority field: move messages with a priority greater than 3 to the "work on later" folder. Mail could also be sorted by the from address. Those userids that start with 'a'-'m' go to one folder, and the rest go to another folder.

通过此扩展,Sieve脚本现在可以确定字段是否大于或小于某个值,而不仅仅是等效值。一个用途是用于x优先级字段:将优先级大于3的邮件移动到“以后工作”文件夹。邮件也可以按发件人地址排序。那些以“a”-“m”开头的用户标识进入一个文件夹,其余的进入另一个文件夹。

The Sieve script can also determine the number of fields in the header, or the number of addresses in a recipient field, for example, whether there are more than 5 addresses in the to and cc fields.

Sieve脚本还可以确定标头中的字段数,或收件人字段中的地址数,例如,to和cc字段中的地址是否超过5个。

The capability string associated with the extension defined in this document is "relational".

与本文档中定义的扩展相关联的功能字符串为“relational”。

2. Conventions Used in This Document
2. 本文件中使用的公约

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14, RFC 2119.

本文件中的关键词“必须”、“不得”、“要求”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照BCP 14、RFC 2119中的说明进行解释。

Conventions for notations are as in [Sieve] section 1.1, including the use of [Kwds] and the use of [ABNF].

符号惯例如[SIVE]第1.1节所述,包括[Kwds]和[ABNF]的使用。

3. Comparators
3. 比较器

This document does not define any comparators or exempt any comparators from the require clause. Any comparator used must be treated as defined in [Sieve].

本文件不定义任何比较器,也不免除任何比较器的要求条款。使用的任何比较器必须按照[筛]中的定义进行处理。

The "i;ascii-numeric" comparator, as defined in [RFC4790], MUST be supported for any implementation of this extension. The comparator "i;ascii-numeric" MUST support at least 32-bit unsigned integers.

此扩展的任何实现都必须支持[RFC4790]中定义的“i;ascii数字”比较器。比较器“i;ascii数字”必须至少支持32位无符号整数。

Larger integers MAY be supported. Note: the "i;ascii-numeric" comparator does not support negative numbers.

可能支持较大的整数。注:“i;ascii数字”比较器不支持负数。

4. Match Types
4. 匹配类型

This document defines two new match types. They are the VALUE match type and the COUNT match type.

本文档定义了两种新的匹配类型。它们是值匹配类型和计数匹配类型。

The syntax is:

语法是:

   MATCH-TYPE =/ COUNT / VALUE
        
   MATCH-TYPE =/ COUNT / VALUE
        

COUNT = ":count" relational-match

COUNT=“:COUNT”关系匹配

VALUE = ":value" relational-match

VALUE=“:VALUE”关系匹配

   relational-match = DQUOTE
           ("gt" / "ge" / "lt" / "le" / "eq" / "ne") DQUOTE
           ; "gt" means "greater than", the C operator ">".
           ; "ge" means "greater than or equal", the C operator ">=".
           ; "lt" means "less than", the C operator "<".
           ; "le" means "less than or equal", the C operator "<=".
           ; "eq" means "equal to", the C operator "==".
           ; "ne" means "not equal to", the C operator "!=".
        
   relational-match = DQUOTE
           ("gt" / "ge" / "lt" / "le" / "eq" / "ne") DQUOTE
           ; "gt" means "greater than", the C operator ">".
           ; "ge" means "greater than or equal", the C operator ">=".
           ; "lt" means "less than", the C operator "<".
           ; "le" means "less than or equal", the C operator "<=".
           ; "eq" means "equal to", the C operator "==".
           ; "ne" means "not equal to", the C operator "!=".
        
4.1. Match Type VALUE
4.1. 匹配类型值

The VALUE match type does a relational comparison between strings.

值匹配类型在字符串之间进行关系比较。

The VALUE match type may be used with any comparator that returns sort information.

值匹配类型可以与返回排序信息的任何比较器一起使用。

A value from the message is considered the left side of the relation. A value from the test expression, the key-list for address, envelope, and header tests, is the right side of the relation.

消息中的值被视为关系的左侧。测试表达式(地址、信封和标头测试的键列表)中的值位于关系的右侧。

If there are multiple values on either side or both sides, the test is considered true if any pair is true.

如果任意一侧或两侧有多个值,则如果任何一对值为真,则该测试视为真。

4.2. Match Type COUNT
4.2. 匹配类型计数

The COUNT match type first determines the number of the specified entities in the message and does a relational comparison of the number of entities, as defined below, to the values specified in the test expression.

计数匹配类型首先确定消息中指定实体的数量,并将实体数量(如下定义)与测试表达式中指定的值进行关系比较。

The COUNT match type SHOULD only be used with numeric comparators.

计数匹配类型只能与数字比较器一起使用。

The Address Test counts the number of addresses (the number of "mailbox" elements, as defined in [RFC2822]) in the specified fields. Group names are ignored, but the contained mailboxes are counted.

地址测试统计指定字段中的地址数(“邮箱”元素的数量,如[RFC2822]中所定义)。忽略组名,但统计包含的邮箱。

The Envelope Test counts the number of addresses in the specified envelope parts. The envelope "to" will always have only one entry, which is the address of the user for whom the Sieve script is running. Using this test, there is no way a Sieve script can determine if the message was actually sent to someone else. The envelope "from" will be 0 if the MAIL FROM is empty, or 1 if MAIL FROM is not empty.

信封测试统计指定信封部分中的地址数。信封“to”始终只有一个条目,即正在为其运行筛选脚本的用户的地址。使用此测试,筛选脚本无法确定消息是否确实发送给了其他人。如果邮件发件人为空,则信封“发件人”将为0;如果邮件发件人不为空,则信封“发件人”将为1。

The Header Test counts the total number of instances of the specified fields. This does not count individual addresses in the "to", "cc", and other recipient fields.

标头测试统计指定字段的实例总数。这不包括“收件人”、“抄送”和其他收件人字段中的单个地址。

In all cases, if more than one field name is specified, the counts for all specified fields are added together to obtain the number for comparison. Thus, specifying ["to", "cc"] in an address COUNT test compares the total number of "to" and "cc" addresses; if separate counts are desired, they must be done in two comparisons, perhaps joined by "allof" or "anyof".

在所有情况下,如果指定了多个字段名,则将所有指定字段的计数相加,以获得用于比较的数字。因此,在地址计数测试中指定[“to”,“cc”]比较“to”和“cc”地址的总数;如果需要单独的计数,则必须在两次比较中进行,可能加上“allof”或“anyof”。

5. Interaction with Other Sieve Actions
5. 与其他筛分作用的相互作用

This specification adds two match types. The VALUE match type only works with comparators that return sort information. The COUNT match type only makes sense with numeric comparators.

此规范添加了两种匹配类型。值匹配类型仅适用于返回排序信息的比较器。计数匹配类型仅适用于数字比较器。

There is no interaction with any other Sieve operations, nor with any known extensions. In particular, this specification has no effect on implicit KEEP, nor on any explicit message actions.

没有与任何其他筛网操作或任何已知扩展的交互作用。特别是,该规范对隐式KEEP和任何显式消息操作都没有影响。

6. Example
6. 实例

Using the message:

使用消息:

      received: ...
      received: ...
      subject: example
      to: foo@example.com, baz@example.com
      cc: qux@example.com
        
      received: ...
      received: ...
      subject: example
      to: foo@example.com, baz@example.com
      cc: qux@example.com
        

The test:

测试:

address :count "ge" :comparator "i;ascii-numeric" ["to", "cc"] ["3"]

地址:计数“ge”:比较器“i;ascii数字”[“至”,“抄送”][“3”]

would evaluate to true, and the test

将评估为真,并且测试

      anyof ( address :count "ge" :comparator "i;ascii-numeric"
                      ["to"] ["3"],
              address :count "ge" :comparator "i;ascii-numeric"
                      ["cc"] ["3"] )
        
      anyof ( address :count "ge" :comparator "i;ascii-numeric"
                      ["to"] ["3"],
              address :count "ge" :comparator "i;ascii-numeric"
                      ["cc"] ["3"] )
        

would evaluate to false.

将评估为false。

To check the number of received fields in the header, the following test may be used:

要检查报头中接收字段的数量,可以使用以下测试:

header :count "ge" :comparator "i;ascii-numeric" ["received"] ["3"]

标题:计数“ge”:比较器“i;ascii数字”[“接收”][“3”]

This would evaluate to false. But

这将评估为错误。但是

header :count "ge" :comparator "i;ascii-numeric" ["received", "subject"] ["3"]

标题:计数“ge”:比较器“i;ascii数字”[“接收”,“主题”][“3”]

would evaluate to true.

将评估为真。

The test:

测试:

header :count "ge" :comparator "i;ascii-numeric" ["to", "cc"] ["3"]

标题:计数“ge”:比较器“i;ascii数字”[“to”,“cc”][“3”]

will always evaluate to false on an RFC 2822 compliant message [RFC2822], since a message can have at most one "to" field and at most one "cc" field. This test counts the number of fields, not the number of addresses.

在符合RFC 2822的消息[RFC2822]上,将始终计算为false,因为消息最多可以有一个“to”字段和一个“cc”字段。此测试统计字段数,而不是地址数。

7. Extended Example
7. 扩展示例

require ["relational", "comparator-i;ascii-numeric", "fileinto"];

要求[“关系”、“比较器-i;ascii数字”、“文件导入”];

      if header :value "lt" :comparator "i;ascii-numeric"
                ["x-priority"] ["3"]
      {
         fileinto "Priority";
      }
        
      if header :value "lt" :comparator "i;ascii-numeric"
                ["x-priority"] ["3"]
      {
         fileinto "Priority";
      }
        
      elsif address :count "gt" :comparator "i;ascii-numeric"
                 ["to"] ["5"]
      {
         # everything with more than 5 recipients in the "to" field
         # is considered SPAM
         fileinto "SPAM";
      }
        
      elsif address :count "gt" :comparator "i;ascii-numeric"
                 ["to"] ["5"]
      {
         # everything with more than 5 recipients in the "to" field
         # is considered SPAM
         fileinto "SPAM";
      }
        
      elsif address :value "gt" :all :comparator "i;ascii-casemap"
                 ["from"] ["M"]
      {
         fileinto "From N-Z";
      } else {
         fileinto "From A-M";
      }
        
      elsif address :value "gt" :all :comparator "i;ascii-casemap"
                 ["from"] ["M"]
      {
         fileinto "From N-Z";
      } else {
         fileinto "From A-M";
      }
        
      if allof ( address :count "eq" :comparator "i;ascii-numeric"
                         ["to", "cc"] ["1"] ,
                 address :all :comparator "i;ascii-casemap"
                         ["to", "cc"] ["me@foo.example.com"] )
      {
         fileinto "Only me";
      }
        
      if allof ( address :count "eq" :comparator "i;ascii-numeric"
                         ["to", "cc"] ["1"] ,
                 address :all :comparator "i;ascii-casemap"
                         ["to", "cc"] ["me@foo.example.com"] )
      {
         fileinto "Only me";
      }
        
8. Changes since RFC 3431
8. 自RFC 3431以来的变化

Apart from several minor editorial/wording changes, the following list describes the notable changes to this specification since RFC 3431.

除了一些小的编辑/措辞变更外,以下列表描述了自RFC 3431以来本规范的显著变更。

o Updated references, including changing the comparator reference from the Application Configuration Access Protocol (ACAP) to the "Internet Application Protocol Collation Registry" document [RFC4790].

o 更新参考,包括将比较器参考从应用程序配置访问协议(ACAP)更改为“互联网应用程序协议整理注册表”文档[RFC4790]。

o Updated and corrected the examples.

o 更新并更正了示例。

o Added definition comments to ABNF for "gt", "lt", etc.

o 在ABNF中添加了“gt”、“lt”等的定义注释。

o Clarified what RFC 2822 elements are counted in the COUNT test.

o 澄清了计数测试中计数的RFC 2822元素。

o Removed the requirement to strip white space from header fields before comparing; a more general version of this requirement has been added to the Sieve base spec.

o 删除了在比较前从标题字段中去掉空白的要求;该要求的更一般版本已添加到筛基规范中。

9. IANA Considerations
9. IANA考虑

The following template specifies the IANA registration of the relational Sieve extension specified in this document:

以下模板指定了本文档中指定的关系筛扩展的IANA注册:

To: iana@iana.org Subject: Registration of new Sieve extension

致:iana@iana.org主题:新筛网扩展的注册

   Capability name: relational
   Description:     Extends existing conditional tests in Sieve language
                    to allow relational operators
   RFC number:      RFC 5231
   Contact address: The Sieve discussion list <ietf-mta-filters@imc.org>
        
   Capability name: relational
   Description:     Extends existing conditional tests in Sieve language
                    to allow relational operators
   RFC number:      RFC 5231
   Contact address: The Sieve discussion list <ietf-mta-filters@imc.org>
        
10. Security Considerations
10. 安全考虑

An implementation MUST ensure that the test for envelope "to" only reflects the delivery to the current user. Using this test, it MUST not be possible for a user to determine if this message was delivered to someone else.

实现必须确保信封“to”的测试只反映对当前用户的交付。使用此测试,用户不能确定此消息是否已传递给其他人。

Additional security considerations are discussed in [Sieve].

其他安全注意事项在[SIFE]中讨论。

11. Normative References
11. 规范性引用文件

[ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 4234, October 2005.

[ABNF]Crocker,D.,Ed.和P.Overell,“语法规范的扩充BNF:ABNF”,RFC 42342005年10月。

[Kwds] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, March 1997.

[Kwds]Bradner,S.,“RFC中用于表示需求水平的关键词”,RFC 211997年3月。

[RFC2822] Resnick, P., "Internet Message Format", RFC 2822, April 2001.

[RFC2822]Resnick,P.,“互联网信息格式”,RFC 2822,2001年4月。

[RFC4790] Newman, C., Duerst, M., and A. Gulbrandsen, "Internet Application Protocol Collation Registry", RFC 4790, March 2007.

[RFC4790]Newman,C.,Duerst,M.,和A.Gulbrandsen,“互联网应用协议整理注册表”,RFC 47902007年3月。

[Sieve] Guenther, P., Ed. and T. Showalter, Ed., "Sieve: An Email Filtering Language", RFC 5228, January 2008.

[筛]Guenther,P.,Ed.和T.Showalter,Ed.,“筛:电子邮件过滤语言”,RFC 5228,2008年1月。

Authors' Addresses

作者地址

Wolfgang Segmuller IBM T.J. Watson Research Center 19 Skyline Drive Hawthorne, NY 10532 US

美国纽约州霍桑市天际大道19号Wolfgang Segmuller IBM T.J.Watson研究中心,邮编10532

   Phone: +1 914 784 7408
   EMail: werewolf@us.ibm.com
        
   Phone: +1 914 784 7408
   EMail: werewolf@us.ibm.com
        

Barry Leiba IBM T.J. Watson Research Center 19 Skyline Drive Hawthorne, NY 10532 US

Barry Leiba IBM T.J.Watson研究中心美国纽约州霍桑市天际大道19号,邮编10532

   Phone: +1 914 784 7941
   EMail: leiba@watson.ibm.com
        
   Phone: +1 914 784 7941
   EMail: leiba@watson.ibm.com
        

Full Copyright Statement

完整版权声明

Copyright (C) The IETF Trust (2008).

版权所有(C)IETF信托基金(2008年)。

This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.

本文件受BCP 78中包含的权利、许可和限制的约束,除其中规定外,作者保留其所有权利。

This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

本文件及其包含的信息以“原样”为基础提供,贡献者、他/她所代表或赞助的组织(如有)、互联网协会、IETF信托基金和互联网工程任务组不承担任何明示或暗示的担保,包括但不限于任何保证,即使用本文中的信息不会侵犯任何权利,或对适销性或特定用途适用性的任何默示保证。

Intellectual Property

知识产权

The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.

IETF对可能声称与本文件所述技术的实施或使用有关的任何知识产权或其他权利的有效性或范围,或此类权利下的任何许可可能或可能不可用的程度,不采取任何立场;它也不表示它已作出任何独立努力来确定任何此类权利。有关RFC文件中权利的程序信息,请参见BCP 78和BCP 79。

Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.

向IETF秘书处披露的知识产权副本和任何许可证保证,或本规范实施者或用户试图获得使用此类专有权利的一般许可证或许可的结果,可从IETF在线知识产权存储库获取,网址为http://www.ietf.org/ipr.

The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.

IETF邀请任何相关方提请其注意任何版权、专利或专利申请,或其他可能涵盖实施本标准所需技术的专有权利。请将信息发送至IETF的IETF-ipr@ietf.org.