Network Working Group                                       A.  Melnikov
Request for Comments: 5232                                 Isode Limited
Category: Standards Track                                   January 2008
        
Network Working Group                                       A.  Melnikov
Request for Comments: 5232                                 Isode Limited
Category: Standards Track                                   January 2008
        

Sieve Email Filtering: Imap4flags Extension

筛选电子邮件筛选:IMAP4扩展

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

摘要

Recent discussions have shown that it is desirable to set different IMAP (RFC 3501) flags on message delivery. This can be done, for example, by a Sieve interpreter that works as a part of a Mail Delivery Agent.

最近的讨论表明,在消息传递上设置不同的IMAP(RFC 3501)标志是可取的。例如,这可以通过作为邮件传递代理的一部分的Sieve解释器来完成。

This document describes an extension to the Sieve mail filtering language for setting IMAP flags. The extension allows setting of both IMAP system flags and IMAP keywords.

本文档描述了用于设置IMAP标志的Sieve邮件过滤语言的扩展。扩展允许设置IMAP系统标志和IMAP关键字。

Table of Contents

目录

   1. Introduction ....................................................2
      1.1. Conventions Used ...........................................2
   2. General Requirements for Flag Handling ..........................3
   3. Actions .........................................................3
      3.1. Action setflag .............................................4
      3.2. Action addflag .............................................4
      3.3. Action removeflag ..........................................5
   4. Test hasflag ....................................................6
   5. Tagged Argument :flags ..........................................7
   6. Interaction with Other Sieve Actions ............................8
   7. Security Considerations .........................................8
   8. IANA Considerations .............................................8
   9. Extended Example ................................................8
   10. Acknowledgments ...............................................10
   11. Normative References ..........................................10
        
   1. Introduction ....................................................2
      1.1. Conventions Used ...........................................2
   2. General Requirements for Flag Handling ..........................3
   3. Actions .........................................................3
      3.1. Action setflag .............................................4
      3.2. Action addflag .............................................4
      3.3. Action removeflag ..........................................5
   4. Test hasflag ....................................................6
   5. Tagged Argument :flags ..........................................7
   6. Interaction with Other Sieve Actions ............................8
   7. Security Considerations .........................................8
   8. IANA Considerations .............................................8
   9. Extended Example ................................................8
   10. Acknowledgments ...............................................10
   11. Normative References ..........................................10
        
1. Introduction
1. 介绍

This is an extension to the Sieve language defined by [SIEVE] for setting [IMAP] flags. It adds a new tagged argument to "keep" and "fileinto" that describes the list of flags that have to be set when the message is delivered to the specified mailbox. It also adds several actions to help manipulate list of flags and a test to check whether a flag belongs to a list.

这是对[Sieve]定义的用于设置[IMAP]标志的Sieve语言的扩展。它在“keep”和“fileinto”中添加了一个新的标记参数,该参数描述了在将邮件传递到指定邮箱时必须设置的标志列表。它还添加了几个操作来帮助操作标志列表,并添加了一个测试来检查标志是否属于列表。

From the user's perspective, this extension provides several capabilities. First, it allows manipulation of sets of IMAP flags. Second, it gives the ability to associate a set of IMAP flags with a message that is delivered to a mailstore using the keep/fileinto actions. Third, it maintains an internal variable. The internal variable contains the default flags that will be associated with a message that is delivered using the keep, implicit keep, or fileinto actions, when the :flags tagged argument is not specified. When the Sieve [VARIABLES] extension is also supported by the Sieve engine, it enables support for multiple variables containing sets of IMAP flags.

从用户的角度来看,此扩展提供了几个功能。首先,它允许操纵IMAP标志集。其次,它能够将一组IMAP标志与使用keep/fileinto操作传递到邮件存储的消息相关联。第三,它保持一个内部变量。当未指定:flags taged参数时,内部变量包含与使用keep、implicit keep或fileinto操作传递的消息关联的默认标志。当Sieve引擎也支持Sieve[VARIABLES]扩展时,它支持包含多组IMAP标志的多个变量。

The capability string associated with the extension defined in this document is "imap4flags". All conformant implementations MUST implement all Sieve actions (setflag, addflag, removeflag), the "hasflag" test, and the ":flags" tagged argument described in this document.

与本文档中定义的扩展相关联的功能字符串为“imap4flags”。所有一致性实现必须实现本文档中描述的所有筛选操作(setflag、addflag、removeflag)、“hasflag”测试和“:flags”标记参数。

The "imap4flags" extension can be used with or without the "variables" extension [VARIABLES]. When the "variables" extension is enabled in a script using <require "variables">, the script can use explicit variable names in setflag/addflag/removeflag actions and the hasflag test. See also Section 3 for more details. When the "variables" extension is not enabled, the explicit variable name parameter to setflag/addflag/removeflag/hasflag MUST NOT be used and MUST cause an error according to [SIEVE].

“imap4flags”扩展可以与“variables”扩展[变量]一起使用,也可以不与“variables”扩展[变量]一起使用。使用<require“variables”>在脚本中启用“variables”扩展时,脚本可以在setflag/addflag/removeflag操作和hasflag测试中使用显式变量名。有关更多详细信息,请参见第3节。未启用“variables”扩展时,不得使用setflag/addflag/removeflag/hasflag的显式变量名参数,并且必须根据[SIEVE]导致错误。

1.1. Conventions Used
1.1. 使用的惯例

Conventions for notations are as in [SIEVE], Section 1.1, including use of "Usage:" label for the definition of action and tagged arguments syntax.

符号惯例如[SIFE]第1.1节所述,包括使用“用法:”标签定义动作和标记参数语法。

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 RFC 2119.

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

2. General Requirements for Flag Handling
2. 旗帜处理的一般要求

The following notes apply to processing of addflag/removeflag/setflag actions, the "hasflag" test and the ":flags" tagged argument.

以下注释适用于addflag/removeflag/setflag操作、“hasflag”测试和“:flags”标记参数的处理。

A Sieve interpreter MUST ignore empty strings (i.e., "") in a list-of-flags parameter.

筛解释器必须忽略参数标志列表中的空字符串(即“”)。

A string containing a space-separated list of flag names is equivalent to a string list consisting of the flags. This requirement is to simplify amalgamation of multiple flag lists.

包含以空格分隔的标志名称列表的字符串相当于由标志组成的字符串列表。这一要求是为了简化多个标志列表的合并。

The Sieve interpreter SHOULD check the list of flags for validity as described by [IMAP] ABNF. In particular, according to [IMAP], non-ASCII characters are not allowed in flag names. However, spaces MUST always be allowed as delimiters in strings representing a list of flags. In such strings, multiple spaces between flag names MUST be treated as a single space character, and leading and trailing spaces MUST be ignored.

筛解释器应按照[IMAP]ABNF所述检查标志列表的有效性。特别是,根据[IMAP],标志名称中不允许使用非ASCII字符。但是,在表示标志列表的字符串中,必须始终允许空格作为分隔符。在此类字符串中,必须将标志名称之间的多个空格视为单个空格字符,并且必须忽略前导空格和尾随空格。

If a flag validity check fails, the flag MUST be ignored.

如果标志有效性检查失败,则必须忽略该标志。

Note that it is not possible to use this extension to set or clear the \Recent flag or any other special system flag that is not settable in [IMAP]. Any such flags MUST be ignored if included in a flag list.

请注意,无法使用此扩展设置或清除\Recent标志或[IMAP]中无法设置的任何其他特殊系统标志。如果包含在标志列表中,则必须忽略任何此类标志。

3. Actions
3. 行动

All actions described in this specification (setflag, addflag, removeflag) operate on string variables that contain a set of [IMAP] flags. On variable substitution, a set of flags is represented as a string containing a space-separated list of flag names.

本规范中描述的所有操作(setflag、addflag、removeflag)都对包含一组[IMAP]标志的字符串变量进行操作。在变量替换中,一组标志表示为一个字符串,其中包含一个以空格分隔的标志名称列表。

Any setflag/addflag/removeflag action MAY alter the flag list in any way that leaves its semantics as a set of case-insensitive words unaltered. For example, it may reorder the flags, alter the case of the letters in them, or add or remove duplicates or extraneous spaces. Scripts MUST NOT make assumptions about the ordering of flags in lists or the preservation of their case.

任何setflag/addflag/removeflag操作都可能以任何方式更改标志列表,使其语义作为一组不区分大小写的单词保持不变。例如,它可能会对标志重新排序,改变标志中字母的大小写,或者添加或删除重复或多余的空格。脚本不得对列表中标志的顺序或其大小写的保存进行假设。

Note that the parameter specifying a variable name to setflag/addflag/removeflag actions and the hasflag test is optional. If the parameter is not specified, the actions operate on the internal variable, which has the empty value when the script starts execution. If the SIEVE interpreter doesn't support the "variables" extension [VARIABLES], the presence of the variable name parameter will cause a runtime error [SIEVE].

请注意,为setflag/addflag/removeflag操作和hasflag测试指定变量名的参数是可选的。如果未指定参数,则操作将对内部变量进行操作,该变量在脚本开始执行时具有空值。如果SIEVE解释器不支持“variables”扩展名[variables],则变量名参数的存在将导致运行时错误[SIEVE]。

The "addflag" action adds flags to an existing set. The "removeflag" action removes flags from an existing set. The "setflag" action replaces an existing set of flags with a new set. The "set" action defined in [VARIABLES] can be used to replace an existing set of flags with a new set as well. However, it should be noted that the "set" action can't perform any flag reordering, duplicate elimination, etc.

“addflag”操作向现有集合添加标志。“removeflag”操作从现有集合中移除标志。“setflag”操作将现有的一组标志替换为一组新标志。[VARIABLES]中定义的“set”操作也可用于用新的标志集替换现有的标志集。但是,应该注意,“set”操作不能执行任何标志重新排序、重复消除等操作。

The :flags tagged argument to "keep" and "fileinto" actions is used to associate a set of flags with the current message. If the :flags tagged argument is not specified with those two actions, the current value of the internal variable is used instead. The value of the internal variable also applies to the implicit keep.

用于“keep”和“fileinto”操作的:flags taged参数用于将一组标志与当前消息相关联。如果未在这两个操作中指定:flags taged参数,则将使用内部变量的当前值。内部变量的值也适用于隐式keep。

Note that when keep/fileinto is used multiple times in a script and duplicate message elimination is performed (as described in Section 2.10.3 of [SIEVE]), the last flag list value MUST win.

请注意,在脚本中多次使用keep/fileinto并执行重复消息消除(如[SIEVE]第2.10.3节所述)时,最后一个标志列表值必须获胜。

3.1. Action setflag
3.1. 动作设置标志
   Usage:   setflag [<variablename: string>]
            <list-of-flags: string-list>
        
   Usage:   setflag [<variablename: string>]
            <list-of-flags: string-list>
        

Setflag is used for setting [IMAP] system flags or keywords. Setflag replaces any previously set flags.

Setflag用于设置[IMAP]系统标志或关键字。Setflag将替换以前设置的任何标志。

   Example:  if size :over 500K {
                 setflag "\\Deleted";
             }
        
   Example:  if size :over 500K {
                 setflag "\\Deleted";
             }
        

A more substantial example is the following:

一个更具体的例子如下:

   Example:
        if header :contains "from" "boss@frobnitzm.example.edu" {
            setflag "flagvar" "\\Flagged";
            fileinto :flags "${flagvar}" "INBOX.From Boss";
        }
        
   Example:
        if header :contains "from" "boss@frobnitzm.example.edu" {
            setflag "flagvar" "\\Flagged";
            fileinto :flags "${flagvar}" "INBOX.From Boss";
        }
        
3.2. Action addflag
3.2. 动作添加标志
   Usage:   addflag [<variablename: string>]
            <list-of-flags: string-list>
        
   Usage:   addflag [<variablename: string>]
            <list-of-flags: string-list>
        

Addflag is used to add flags to a list of [IMAP] flags. It doesn't replace any previously set flags. This means that multiple occurrences of addflag are treated additively.

Addflag用于将标志添加到[IMAP]标志列表中。它不会替换以前设置的任何标志。这意味着addflag的多次出现将被附加处理。

The following examples demonstrate requirements described in Section 2.1. The following two actions

以下示例演示了第2.1节中描述的要求。以下两项行动

      addflag "flagvar" "\\Deleted";
      addflag "flagvar" "\\Answered";
        
      addflag "flagvar" "\\Deleted";
      addflag "flagvar" "\\Answered";
        

produce the same result as the single action

产生与单个动作相同的结果

addflag "flagvar" ["\\Deleted", "\\Answered"];

addflag“flagvar”[“\\Deleted”,“\\Responsed”];

or

addflag "flagvar" "\\Deleted \\Answered";

addflag“flagvar”“\\Deleted\\Answered”;

or

addflag "flagvar" "\\Answered \\Deleted";

addflag“flagvar”“\\Answered\\Deleted”;

3.3. Action removeflag
3.3. 动作移除标志
   Usage:   removeflag [<variablename: string>]
            <list-of-flags: string-list>
        
   Usage:   removeflag [<variablename: string>]
            <list-of-flags: string-list>
        

Removeflag is used to remove flags from a list of [IMAP] flags. Removeflag clears flags previously set by "set"/"addflag". Calling removeflag with a flag that wasn't set before is not an error and is ignored. Note that if an implementation doesn't perform automatic duplicate elimination, it MUST remove all occurrences of the flags specified in the second parameter to removeflag. Empty strings in the list-of-flags MUST be ignored. Also note that flag names are case-insensitive, as described in [IMAP]. Multiple removeflag actions are treated additively.

Removeflag用于从[IMAP]标志列表中删除标志。Removeflag清除以前由“set”/“addflag”设置的标志。使用以前未设置的标志调用removeflag不是错误,将被忽略。请注意,如果实现不执行自动消除重复,则必须删除在removeflag的第二个参数中指定的所有标志。必须忽略标志列表中的空字符串。还请注意,标志名称不区分大小写,如[IMAP]中所述。多个removeflag操作被附加处理。

      Example:
        if header :contains "Disposition-Notification-To"
           "mel@example.com" {
            addflag "flagvar" "$MDNRequired";
        }
        if header :contains "from" "imap@cac.washington.example.edu" {
            removeflag "flagvar" "$MDNRequired";
            fileinto :flags "${flagvar}" "INBOX.imap-list";
        }
        
      Example:
        if header :contains "Disposition-Notification-To"
           "mel@example.com" {
            addflag "flagvar" "$MDNRequired";
        }
        if header :contains "from" "imap@cac.washington.example.edu" {
            removeflag "flagvar" "$MDNRequired";
            fileinto :flags "${flagvar}" "INBOX.imap-list";
        }
        
4. Test hasflag
4. 测试标志
   Usage: hasflag [MATCH-TYPE] [COMPARATOR]
          [<variable-list: string-list>]
          <list-of-flags: string-list>
        
   Usage: hasflag [MATCH-TYPE] [COMPARATOR]
          [<variable-list: string-list>]
          <list-of-flags: string-list>
        

The hasflag test evaluates to true if any of the variables matches any flag name. The type of match defaults to ":is". If the list of variables is omitted, value of the internal variable is used instead.

如果任何变量与任何标志名称匹配,则hasflag测试的计算结果为true。匹配类型默认为“:is”。如果省略变量列表,则使用内部变量的值。

The default comparator is "i;ascii-casemap", which is the same case-insensitive comparison as defined for IMAP flags by [IMAP].

默认的比较器是“i;ascii casemap”,这与[IMAP]为IMAP标志定义的不区分大小写的比较相同。

The "relational" extension [RELATIONAL] adds a match type called ":count". The :count of a variable returns the number of distinct flags in it. The count of a list of variables is the sum of the counts of the member variables.

“relational”扩展[relational]添加了一个名为“:count”的匹配类型。变量的:count返回其中不同标志的数量。变量列表的计数是成员变量计数的总和。

Example: If the internal variable has the value "A B", the following test

示例:如果内部变量的值为“A B”,则执行以下测试

hasflag :is "b A"

hasflag:是“b A”

evaluates to true. The above test can also be written as

计算结果为true。上述测试也可以写成

hasflag ["b","A"]

hasflag[“b”,“A”]

Example: If the variable "MyVar" has value "NonJunk Junk gnus-forward $Forwarded NotJunk JunkRecorded $Junk $NotJunk", the following tests evaluate to true:

示例:如果变量“MyVar”的值为“NonJunk Junk gnus forward$Forwarded NotJunk JunkRecorded$Junk$NotJunk”,则以下测试评估为true:

hasflag :contains "MyVar" "Junk" hasflag :contains "MyVar" "forward" hasflag :contains "MyVar" ["label", "forward"] hasflag :contains "MyVar" ["junk", "forward"]

hasflag:包含“MyVar”“垃圾邮件”hasflag:包含“MyVar”“转发”hasflag:包含“MyVar”[“标签”,“转发”]hasflag:包含“MyVar”[“垃圾邮件”,“转发”]

Note that the last of these tests can be rewritten as

请注意,最后一个测试可以重写为

hasflag :contains "MyVar" "junk forward"

hasflag:包含“MyVar”“垃圾转发”

or

hasflag :contains "MyVar" "forward junk"

hasflag:包含“MyVar”“转发垃圾”

However, the last two forms are not recommended.

但是,不建议使用最后两种形式。

And the following tests will evaluate to false:

以下测试将评估为错误:

hasflag :contains "MyVar" "label"

hasflag:包含“MyVar”标签

hasflag :contains "MyVar" ["label1", "label2"]

hasflag:包含“MyVar”[“label1”、“label2”]

Example: If the variable "MyFlags" has the value "A B", the following test

示例:如果变量“MyFlags”的值为“ab”,则以下测试

hasflag :count "ge" :comparator "i;ascii-numeric" "MyFlags" "2"

hasflag:计数“ge”:比较器“i”;ascii数字“MyFlags”2

evaluates to true, as the variable contains 2 distinct flags.

计算结果为true,因为变量包含两个不同的标志。

5. Tagged Argument :flags
5. 标记参数:标志

This specification adds a new optional tagged argument ":flags" that alters the behavior of actions "keep" and "fileinto".

此规范添加了一个新的可选标记参数“:flags”,用于更改操作“keep”和“fileinto”的行为。

The :flags tagged argument specifies that the flags provided in the subsequent argument should be set when fileinto/keep delivers the message to the target mailbox/user's main mailbox. If the :flags tagged argument is not specified, "keep" or "fileinto" will use the current value of the internal variable when delivering the message to the target mailbox.

:flags taged参数指定在fileinto/keep将邮件传递到目标邮箱/用户的主邮箱时,应设置后续参数中提供的标志。如果未指定:flags taged参数,“keep”或“fileinto”将在将邮件传递到目标邮箱时使用内部变量的当前值。

   Usage:   ":flags" <list-of-flags: string-list>
        
   Usage:   ":flags" <list-of-flags: string-list>
        

The copy of the message filed into the mailbox will have only flags listed after the :flags tagged argument.

归档到邮箱中的邮件副本将仅在:flags taged参数后列出标志。

The Sieve interpreter MUST ignore all flags that it can't store permanently. This means that the interpreter MUST NOT treat failure to store any flag as a runtime failure to execute the Sieve script. For example, if the mailbox "INBOX.From Boss" can't store any flags, then

筛解释器必须忽略它不能永久存储的所有标志。这意味着解释器不能将存储任何标志的失败视为执行筛选脚本的运行时失败。例如,如果邮箱“INBOX.From Boss”无法存储任何标志,则

fileinto :flags "\\Deleted" "INBOX.From Boss";

fileinto:flags“\\Deleted”“INBOX.From Boss”;

and

fileinto "INBOX.From Boss";

文件导入“收件箱。来自老板”;

are equivalent.

它们是等价的。

This document doesn't dictate how the Sieve interpreter will set the [IMAP] flags. In particular, the Sieve interpreter may work as an IMAP client or may have direct access to the mailstore.

本文档没有说明筛子解释器将如何设置[IMAP]标志。特别是,Sieve解释器可以作为IMAP客户机使用,也可以直接访问邮件存储。

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

This extension works only on the message that is currently being processed by Sieve; it doesn't affect another message generated as a side effect of any action or any other message already in the mailstore.

此扩展仅对当前正在由Sieve处理的消息起作用;它不会影响作为任何操作的副作用生成的另一封邮件或邮件存储中已有的任何其他邮件。

The extension described in this document doesn't change the implicit keep (see Section 2.10.2 of [SIEVE]).

本文件中描述的扩展不会改变隐式保留(见[SIFE]第2.10.2节)。

7. Security Considerations
7. 安全考虑

Security considerations are discussed in [IMAP], [SIEVE], and [VARIABLES].

[IMAP]、[SIFE]和[VARIABLES]中讨论了安全注意事项。

This extension intentionally doesn't allow setting [IMAP] flags on an arbitrary message in the [IMAP] message store.

此扩展有意不允许在[IMAP]消息存储中的任意消息上设置[IMAP]标志。

It is believed that this extension doesn't introduce any additional security concerns.

据信,此扩展不会带来任何额外的安全问题。

8. IANA Considerations
8. IANA考虑

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

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

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

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

   Capability name: imap4flags
   Description:     Adds actions and tests for manipulating IMAP flags
   RFC number:      RFC 5232
   Contact address: The Sieve discussion list <ietf-mta-filters@imc.org>
        
   Capability name: imap4flags
   Description:     Adds actions and tests for manipulating IMAP flags
   RFC number:      RFC 5232
   Contact address: The Sieve discussion list <ietf-mta-filters@imc.org>
        

This information has been added to the list of Sieve extensions given on http://www.iana.org/assignments/sieve-extensions.

此信息已添加到上给出的筛网扩展列表中http://www.iana.org/assignments/sieve-extensions.

9. Extended Example
9. 扩展示例

# # Example Sieve Filter # Declare any optional features or extension used by the script # require ["fileinto", "imap4flags", "variables"];

##示例筛选过滤器#声明脚本使用的任何可选功能或扩展#要求[“fileinto”、“imap4flags”、“variables”];

# # Move large messages to a special mailbox #

##将大型邮件移动到特殊邮箱#

   if size :over 1M
           {
           addflag "MyFlags" "Big";
           if header :is "From" "boss@company.example.com"
                      {
   # The message will be marked as "\Flagged Big" when filed into
   # mailbox "Big messages"
                      addflag "MyFlags" "\\Flagged";
                      }
           fileinto :flags "${MyFlags}" "Big messages";
           }
        
   if size :over 1M
           {
           addflag "MyFlags" "Big";
           if header :is "From" "boss@company.example.com"
                      {
   # The message will be marked as "\Flagged Big" when filed into
   # mailbox "Big messages"
                      addflag "MyFlags" "\\Flagged";
                      }
           fileinto :flags "${MyFlags}" "Big messages";
           }
        
   if header :is "From" "grandma@example.net"
           {
           addflag "MyFlags" ["\\Answered", "$MDNSent"];
   # If the message is bigger than 1Mb it will be marked as
   # "Big \Answered $MDNSent" when filed into mailbox "grandma".
   # If the message is shorter than 1Mb it will be marked as
   # "\Answered $MDNSent"
           fileinto :flags "${MyFlags}" "GrandMa";
           }
        
   if header :is "From" "grandma@example.net"
           {
           addflag "MyFlags" ["\\Answered", "$MDNSent"];
   # If the message is bigger than 1Mb it will be marked as
   # "Big \Answered $MDNSent" when filed into mailbox "grandma".
   # If the message is shorter than 1Mb it will be marked as
   # "\Answered $MDNSent"
           fileinto :flags "${MyFlags}" "GrandMa";
           }
        
   #
   # Handle messages from known mailing lists
   # Move messages from IETF filter discussion list to filter folder
   #
   if header :is "Sender" "owner-ietf-mta-filters@example.org"
           {
           set "MyFlags" "\\Flagged $Work";
   # Message will have both "\Flagged" and $Work flags
           keep :flags "${MyFlags}";
           }
        
   #
   # Handle messages from known mailing lists
   # Move messages from IETF filter discussion list to filter folder
   #
   if header :is "Sender" "owner-ietf-mta-filters@example.org"
           {
           set "MyFlags" "\\Flagged $Work";
   # Message will have both "\Flagged" and $Work flags
           keep :flags "${MyFlags}";
           }
        
   #
   # Keep all messages to or from people in my company
   #
   elsif anyof address :domain :is ["From", "To"] "company.example.com"
           {
           keep :flags "${MyFlags}"; # keep in "Inbox" folder
           }
        
   #
   # Keep all messages to or from people in my company
   #
   elsif anyof address :domain :is ["From", "To"] "company.example.com"
           {
           keep :flags "${MyFlags}"; # keep in "Inbox" folder
           }
        
   # Try to catch unsolicited email.  If a message is not to me,
   # or it contains a subject known to be spam, file it away.
   #
   elsif anyof (not address :all :contains
                  ["To", "Cc"] "me@company.example.com",
                header :matches "subject"
                  ["*make*money*fast*", "*university*dipl*mas*"])
        
   # Try to catch unsolicited email.  If a message is not to me,
   # or it contains a subject known to be spam, file it away.
   #
   elsif anyof (not address :all :contains
                  ["To", "Cc"] "me@company.example.com",
                header :matches "subject"
                  ["*make*money*fast*", "*university*dipl*mas*"])
        
           {
           remove "MyFlags" "\\Flagged";
           fileinto :flags "${MyFlags}" "spam";
           }
   else
           {
           # Move all other external mail to "personal"
           # folder.
           fileinto :flags "${MyFlags}" "personal";
           }
        
           {
           remove "MyFlags" "\\Flagged";
           fileinto :flags "${MyFlags}" "spam";
           }
   else
           {
           # Move all other external mail to "personal"
           # folder.
           fileinto :flags "${MyFlags}" "personal";
           }
        
10. Acknowledgments
10. 致谢

This document has been revised in part based on comments and discussions that took place on and off the Sieve mailing list.

本文件的修订部分基于在筛选邮件列表内外进行的评论和讨论。

The help of those who took the time to review the document and make suggestions is appreciated, especially that of Tim Showalter, Barry Leiba, Randall Gellens, Ken Murchison, Cyrus Daboo, Matthew Elvey, Jutta Degener, Ned Freed, Marc Mutz, Nigel Swinson, Kjetil Torgrim Homme, Mark E. Mallett, Dave Cridland, Arnt Gulbrandsen, Philip Guenther, Rob Austein, Sam Hartman, Eric Gray, and Cullen Jennings.

感谢那些花时间审阅文件并提出建议的人的帮助,特别是Tim Showalter、Barry Leiba、Randall Gellens、Ken Murchison、Cyrus Daboo、Matthew Elvey、Jutta Degener、Ned Freed、Marc Mutz、Nigel Swinson、Kjetil Torgrim Homme、Mark E.Mallett、Dave Cridland、Arnt Gulbrandsen、Philip Guenther、,罗伯·奥斯汀、山姆·哈特曼、埃里克·格雷和卡伦·詹宁斯。

Special thanks to Tony Hansen and David Lamb for helping me better explain the concept.

特别感谢Tony Hansen和David Lamb帮助我更好地解释这个概念。

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

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

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

[IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, March 2003.

[IMAP]Crispin,M.,“互联网消息访问协议-版本4rev1”,RFC 35012003年3月。

[VARIABLES] Homme, K., "Sieve Email Filtering: Variables Extension", RFC 5229, January 2008.

[VARIABLES]Homme,K.,“筛选电子邮件过滤:变量扩展”,RFC 52292008年1月。

[RELATIONAL] Segmuller, W. and B. Leiba "Sieve Email Filtering: Relational Extension", RFC 5231, January 2008.

[RELATIONAL]Segmuler,W.和B.Leiba,“筛选电子邮件过滤:关系扩展”,RFC 52312008年1月。

Author's Address

作者地址

Alexey Melnikov Isode Limited

阿列克谢·梅尔尼科夫伊索德有限公司

5 Castle Business Village Hampton, Middlesex United Kingdom, TW12 2BX

英国米德尔塞克斯郡汉普顿城堡商业村5号,TW12 2BX

   EMail: alexey.melnikov@isode.com
        
   EMail: alexey.melnikov@isode.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.