Internet Engineering Task Force (IETF)                          S. Bosch
Request for Comments: 8579                               Open Xchange Oy
Category: Standards Track                                       May 2019
ISSN: 2070-1721
        
Internet Engineering Task Force (IETF)                          S. Bosch
Request for Comments: 8579                               Open Xchange Oy
Category: Standards Track                                       May 2019
ISSN: 2070-1721
        

Sieve Email Filtering: Delivering to Special-Use Mailboxes

筛选电子邮件过滤:发送到特殊用途邮箱

Abstract

摘要

The SPECIAL-USE capability of the IMAP protocol (RFC 6154) allows clients to identify special-use mailboxes, e.g., where draft or sent messages should be put. This simplifies client configuration. In contrast, the Sieve mail filtering language (RFC 5228) currently has no such capability. This memo defines a Sieve extension that fills this gap: it adds a test for checking whether a special-use attribute is assigned for a particular mailbox or any mailbox, and it adds the ability to file messages into a mailbox identified solely by a special-use attribute.

IMAP协议(RFC 6154)的特殊用途功能允许客户端识别特殊用途邮箱,例如,草稿或发送的邮件应放在哪里。这简化了客户端配置。相比之下,Sieve邮件过滤语言(rfc5228)目前没有这种功能。此备忘录定义了一个填补此空白的筛选扩展:它添加了一个测试,用于检查是否为特定邮箱或任何邮箱分配了特殊用途属性,并添加了将邮件归档到仅由特殊用途属性标识的邮箱的能力。

Status of This Memo

关于下段备忘

This is an Internet Standards Track document.

这是一份互联网标准跟踪文件。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 7841第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at https://www.rfc-editor.org/info/rfc8579.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问https://www.rfc-editor.org/info/rfc8579.

Copyright Notice

版权公告

Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.

版权(c)2019 IETF信托基金和被确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(https://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

Table of Contents

目录

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Conventions Used in This Document . . . . . . . . . . . . . .   3
   3.  Test "specialuse_exists"  . . . . . . . . . . . . . . . . . .   3
     3.1.  Equivalent IMAP Operations  . . . . . . . . . . . . . . .   4
   4.  ":specialuse" Argument to "fileinto" Command  . . . . . . . .   5
     4.1.  Mailboxes Created Implicitly by the "fileinto" Command  .   6
     4.2.  Equivalent IMAP Operations  . . . . . . . . . . . . . . .   7
   5.  Sieve Capability Strings  . . . . . . . . . . . . . . . . . .   8
   6.  Examples  . . . . . . . . . . . . . . . . . . . . . . . . . .   8
   7.  Security Considerations . . . . . . . . . . . . . . . . . . .   9
   8.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  10
   9.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  10
     9.1.  Normative References  . . . . . . . . . . . . . . . . . .  10
     9.2.  Informative References  . . . . . . . . . . . . . . . . .  11
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  11
   Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .  12
        
   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Conventions Used in This Document . . . . . . . . . . . . . .   3
   3.  Test "specialuse_exists"  . . . . . . . . . . . . . . . . . .   3
     3.1.  Equivalent IMAP Operations  . . . . . . . . . . . . . . .   4
   4.  ":specialuse" Argument to "fileinto" Command  . . . . . . . .   5
     4.1.  Mailboxes Created Implicitly by the "fileinto" Command  .   6
     4.2.  Equivalent IMAP Operations  . . . . . . . . . . . . . . .   7
   5.  Sieve Capability Strings  . . . . . . . . . . . . . . . . . .   8
   6.  Examples  . . . . . . . . . . . . . . . . . . . . . . . . . .   8
   7.  Security Considerations . . . . . . . . . . . . . . . . . . .   9
   8.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  10
   9.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  10
     9.1.  Normative References  . . . . . . . . . . . . . . . . . .  10
     9.2.  Informative References  . . . . . . . . . . . . . . . . .  11
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  11
   Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .  12
        
1. Introduction
1. 介绍

Commonly, several mailboxes in an IMAP message store [IMAP] have a special use. For example, there can be a special-use mailbox for storing the user's draft messages, for keeping copies of sent messages, and for collecting spam messages that were classified as such at delivery. The SPECIAL-USE capability [SPECIAL-USE] of the IMAP protocol defines mailbox attributes that identify these special mailboxes explicitly to the client. This way, client configuration is simplified significantly. Using the CREATE-SPECIAL-USE capability [SPECIAL-USE], IMAP clients can also configure these attributes dynamically based on user preference.

通常,IMAP邮件存储[IMAP]中的几个邮箱有特殊用途。例如,可以有一个特殊用途的邮箱,用于存储用户的草稿邮件、保存已发送邮件的副本以及收集在发送时被分类为垃圾邮件的邮件。IMAP协议的专用功能[SPECIAL-USE]定义了邮箱属性,用于向客户端显式标识这些专用邮箱。这样,客户机配置就大大简化了。使用CREATE-SPECIAL-USE功能[SPECIAL-USE],IMAP客户端还可以根据用户偏好动态配置这些属性。

Unlike the IMAP protocol, the Sieve mail filtering language [SIEVE] currently cannot freely access these special-use mailbox attributes. Particularly, the Sieve interpreter has no means to identify a mailbox with a particular special-use attribute. This would be very useful, for example, to find the user's "Spam" mailbox at delivery.

与IMAP协议不同,Sieve邮件过滤语言[Sieve]目前无法自由访问这些特殊用途邮箱属性。特别是,Sieve解释器无法识别具有特定特殊用途属性的邮箱。这将非常有用,例如,在交付时查找用户的“垃圾邮件”邮箱。

In Sieve, limited access to the special-use attributes is provided using the "mboxmetadata" extension [SIEVE-MAILBOX], which allows testing for the presence of a special-use attribute in the "/private/ specialuse" IMAP METADATA [IMAP-METADATA] entry of a mailbox. Still, not all implementers will be willing to add the complexity of the IMAP METADATA capability just to provide access to special-use attributes to the Sieve interpreter.

在Sieve中,使用“mboxmetadata”扩展[Sieve-MAILBOX]提供对特殊用途属性的有限访问,该扩展允许测试邮箱的“/private/specialuse”IMAP元数据[IMAP-METADATA]条目中是否存在特殊用途属性。尽管如此,并不是所有的实现者都愿意增加IMAP元数据功能的复杂性,只是为了提供对Sieve解释器的特殊用途属性的访问。

This document defines an extension to the Sieve mail filtering language that adds the ability to freely access mailbox special-use attributes. It adds a test called "specialuse_exists" that checks 1) whether a special-use attribute is assigned for a particular mailbox or 2) whether any of the user's personal mailboxes have a special-use attribute assigned. It also adds the ability to file messages into a personal mailbox identified by a particular special-use attribute rather than the mailbox's name. This is achieved using the new ":specialuse" argument for the "fileinto" command [SIEVE].

本文档定义了对Sieve邮件过滤语言的扩展,该语言增加了自由访问邮箱特殊用途属性的能力。它添加了一个名为“specialuse_exists”的测试,用于检查1)是否为特定邮箱分配了特殊使用属性,或2)是否为用户的任何个人邮箱分配了特殊使用属性。它还增加了将邮件归档到由特定特殊用途属性(而不是邮箱名称)标识的个人邮箱的功能。这是通过使用“fileinto”命令[SIEVE]的新“:specialuse”参数实现的。

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

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [KEYWORDS] [KEYWORDS-UPD] when, and only when, they appear in all capitals, as shown here.

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“建议”、“不建议”、“可”和“可选”在所有大写字母出现时(且仅在所有大写字母出现时)应按照BCP 14[关键词][关键词-UPD]中的说明进行解释,如下所示。

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

注释约定如[SIVE]第1.1节所述,包括使用“用法:”标签定义动作和标记参数的语法。

In [IMAP] examples, "C:" and "S:" indicate lines sent by the client and server, respectively. If such lines are wrapped without a new "C:" or "S:" label, then the wrapping is for editorial clarity and is not part of the command.

在[IMAP]示例中,“C:”和“S:”分别表示客户端和服务器发送的行。如果这些行没有新的“C:”或“S:”标签而被换行,则换行是为了编辑清晰,而不是命令的一部分。

3. Test "specialuse_exists"
3. 测试“特殊情况存在”
   Usage:  specialuse_exists [<mailbox: string>]
                             <special-use-attrs: string-list>
        
   Usage:  specialuse_exists [<mailbox: string>]
                             <special-use-attrs: string-list>
        

If the "mailbox" string argument is omitted, the "specialuse_exists" test yields "true" if all of the following statements are true for each of the special-use attributes listed in the special-use-attrs argument:

如果省略“mailbox”字符串参数,“specialuse_exists”测试将生成“true”,前提是对于special use attrs参数中列出的每个特殊用途属性,以下所有语句均为true:

a. At least one mailbox exists in the user's personal namespace [NAMESPACE] that has that particular special-use attribute assigned.

a. 用户的个人命名空间[命名空间]中至少存在一个已分配该特定特殊用途属性的邮箱。

b. That mailbox allows the user in whose context the Sieve script runs to "deliver" messages into it.

b. 该邮箱允许Sieve脚本在其上下文中运行的用户将消息“传递”到该邮箱中。

If the mailbox argument is specified, the "specialuse_exists" test yields "true" if all of the following statements are true:

如果指定了邮箱参数,“specialuse_exists”测试在以下所有语句均为true时生成“true”:

a. The indicated mailbox exists.

a. 指定的邮箱已存在。

b. That mailbox allows the user in whose context the Sieve script runs to "deliver" messages into it.

b. 该邮箱允许Sieve脚本在其上下文中运行的用户将消息“传递”到该邮箱中。

c. That mailbox has all of the special-use attributes listed in the special-use-attrs argument assigned to it.

c. 该邮箱具有分配给它的特殊用途属性参数中列出的所有特殊用途属性。

Refer to the specification of the "mailboxexists" test in Section 3.1 of RFC 5490 [SIEVE-MAILBOX] for a definition of when "delivery" of messages into a mailbox is deemed possible.

请参阅RFC 5490[筛网邮箱]第3.1节中的“邮箱存在”测试规范,了解何时可以将邮件“传递”到邮箱的定义。

3.1. Equivalent IMAP Operations
3.1. 等效IMAP操作

To clarify, the following IMAP protocol examples show a sequence of [IMAP] commands that a client could send to perform an assessment without Sieve that is equivalent to the "specialuse_exists" test.

为了澄清,以下IMAP协议示例显示了一系列[IMAP]命令,客户端可以发送这些命令来执行评估,而无需筛选,这相当于“specialuse_exists”测试。

First, the client queries which namespaces are available using the NAMESPACE command [NAMESPACE]:

首先,客户端使用NAMESPACE命令[NAMESPACE]查询哪些名称空间可用:

   C: A01 NAMESPACE
   S: * NAMESPACE (("INBOX/" "/")("Archive/" "/")) NIL (("Public/" "/"))
   S: A01 OK NAMESPACE command completed
        
   C: A01 NAMESPACE
   S: * NAMESPACE (("INBOX/" "/")("Archive/" "/")) NIL (("Public/" "/"))
   S: A01 OK NAMESPACE command completed
        

Subsequently, when no particular mailbox is of interest (i.e., the "specialuse_exists" test has no mailbox argument), the client lists all mailboxes with special-use attributes in the two returned personal namespaces (this extended LIST command requires the LIST-EXTENDED IMAP capability [LIST-EXTENDED]):

随后,当没有特定邮箱值得关注时(即,“specialuse_exists”测试没有邮箱参数),客户机将在两个返回的个人名称空间中列出具有特殊用途属性的所有邮箱(此扩展列表命令需要LIST-extended IMAP功能[LIST-extended]):

   C: A02 LIST (SPECIAL-USE) "" ("INBOX/*" "Archive/*")
       RETURN (SPECIAL-USE)
   S: * LIST (\Drafts) "/" INBOX/Drafts
   S: * LIST (\Trash) "/" INBOX/Trash
   S: * LIST (\Sent) "/" INBOX/Sent
   S: * LIST (\Archive) "/" Archive/Default
   S: A02 OK LIST command completed
        
   C: A02 LIST (SPECIAL-USE) "" ("INBOX/*" "Archive/*")
       RETURN (SPECIAL-USE)
   S: * LIST (\Drafts) "/" INBOX/Drafts
   S: * LIST (\Trash) "/" INBOX/Trash
   S: * LIST (\Sent) "/" INBOX/Sent
   S: * LIST (\Archive) "/" Archive/Default
   S: A02 OK LIST command completed
        

Finally, using the MYRIGHTS command [IMAP-ACL], the client determines the access rights it has for the mailbox or mailboxes that have all the requested attributes assigned. This way, it can determine whether messages can be saved to any of those. In this example, an "\Archive" special-use mailbox is sought:

最后,使用MYRIGHTS命令[IMAP-ACL],客户端确定其对分配了所有请求属性的邮箱的访问权限。通过这种方式,它可以确定是否可以将消息保存到其中任何一个。在本例中,寻找“\Archive”专用邮箱:

   C: A03 MYRIGHTS Archive/Default
   S: * MYRIGHTS Archive/Default lrwsip
   S: A03 OK Myrights completed
        
   C: A03 MYRIGHTS Archive/Default
   S: * MYRIGHTS Archive/Default lrwsip
   S: A03 OK Myrights completed
        

The MYRIGHTS response indicates that the user has "insert" rights [IMAP-ACL] for the "Archive/Default" mailbox, meaning that the client can deliver (APPEND) messages to that mailbox and that the Sieve "specialuse_exists" test would yield "true" in this case.

MYRIGHTS响应表示用户对“存档/默认”邮箱具有“插入”权限[IMAP-ACL],这意味着客户端可以向该邮箱发送(附加)消息,在这种情况下,筛选“specialuse_exists”测试将生成“true”。

4. ":specialuse" Argument to "fileinto" Command
4. “fileinto”命令的“:specialuse”参数
   Usage:  fileinto [:specialuse <special-use-attr: string>]
                    <mailbox: string>
        
   Usage:  fileinto [:specialuse <special-use-attr: string>]
                    <mailbox: string>
        

Normally, the "fileinto" command delivers the message in the mailbox specified using its positional mailbox argument, which is the name of the mailbox. However, if the optional ":specialuse" argument is also specified, the "fileinto" command first checks whether a mailbox exists in the user's personal namespace [NAMESPACE] with the specified special-use attribute assigned to it. If that is the case, that special-use mailbox is used for delivery instead. If there is no such mailbox or if the specified special-use attribute is unknown to the implementation in general, the "fileinto" action proceeds as it would without the ":specialuse" argument.

通常,“fileinto”命令在使用其位置邮箱参数(即邮箱名称)指定的邮箱中传递邮件。但是,如果还指定了可选的“:specialuse”参数,“fileinto”命令首先检查用户的个人名称空间[namespace]中是否存在分配了指定特殊用途属性的邮箱。如果是这种情况,则使用该专用邮箱进行传递。如果没有这样的邮箱,或者如果实现通常不知道指定的特殊用途属性,“fileinto”操作将按照不带“:specialuse”参数的方式进行。

Summarizing, if the ":specialuse" argument is specified, the "fileinto" command deals with two mailboxes that may or may not exist and may, in fact, be equal:

总之,如果指定了“:specialuse”参数,“fileinto”命令处理两个邮箱,这两个邮箱可能存在,也可能不存在,实际上可能相等:

o A special-use mailbox in the user's personal namespace, which has at least the special-use attribute specified with the ":specialuse" argument assigned to it. The name for this mailbox is not relevant here; it is only identified by the assigned special-use attribute.

o 用户个人名称空间中的特殊用途邮箱,至少具有通过“:specialuse”参数指定的特殊用途属性。此邮箱的名称在此处不相关;它仅由指定的特殊用途属性标识。

o The default mailbox named by the positional string argument of the "fileinto" command, which is used when the special-use mailbox is not found.

o 由“fileinto”命令的位置字符串参数命名的默认邮箱,在未找到特殊用途邮箱时使用。

The special-use attribute specified with the ":specialuse" argument conforms to the "use-attr" syntax described in Section 6 of RFC 6154 [SPECIAL-USE]. Implementations SHOULD handle an invalid special-use attribute in the same way as an invalid mailbox name is handled. The string parameter of the ":specialuse" argument is not a constant string, which means that variable substitutions are allowed when the "variables" extension [VARIABLES] is active. In that case, the syntax of the special-use attribute is only verified at runtime.

用“:specialuse”参数指定的特殊用法属性符合RFC 6154[特殊用法]第6节中描述的“use attr”语法。实现应以处理无效邮箱名称的相同方式处理无效的特殊用途属性。“:specialuse”参数的字符串参数不是常量字符串,这意味着当“variables”扩展名[variables]处于活动状态时,允许进行变量替换。在这种情况下,只能在运行时验证special use属性的语法。

If neither the special-use mailbox nor the default mailbox exists, the "fileinto" action MUST proceed exactly as it does in case the ":specialuse" argument is absent and the mailbox named by its positional argument does not exist. The various options for handling this situation are described in Section 4.1 of RFC 5228 [SIEVE].

如果特殊用途邮箱和默认邮箱均不存在,则“fileinto”操作必须完全按照其操作进行,以防:specialuse”参数不存在且由其位置参数命名的邮箱不存在。RFC 5228[筛]第4.1节描述了处理这种情况的各种选项。

More than one mailbox in the user's personal namespace can have a particular special-use attribute assigned. If one of those mailboxes is, in fact, the default mailbox named by the positional string argument of the "fileinto" command, that mailbox MUST be used for delivery. If the default mailbox is not one of the options, the mailbox that is chosen for delivery is implementation defined. However, while the set of mailboxes to which the involved special-use attribute are assigned remains unchanged, implementations SHOULD ensure that the mailbox choice is made consistently, so that the same mailbox is used every time. Conversely, the chosen mailbox MAY change once the assignments of the special-use attribute that are relevant for the mailbox choice are changed (usually by user interaction).

用户个人命名空间中的多个邮箱可以分配特定的特殊用途属性。如果其中一个邮箱实际上是由“fileinto”命令的位置字符串参数命名的默认邮箱,则必须使用该邮箱进行传递。如果默认邮箱不是选项之一,则选择用于传递的邮箱是实现定义的。但是,虽然分配了相关特殊用途属性的邮箱集保持不变,但实现应确保一致地选择邮箱,以便每次使用相同的邮箱。相反,一旦与邮箱选择相关的特殊用途属性的分配发生更改(通常通过用户交互),所选邮箱可能会发生更改。

If delivery to the special-use mailbox fails for reasons not relating to its existence, the Sieve interpreter MUST NOT subsequently attempt delivery in the indicated default mailbox as a fallback. Instead, it MUST proceed exactly as it does in case the ":specialuse" argument is absent and delivery to the mailbox named by its positional argument fails. This prevents the situation where messages are unexpectedly spread over two mailboxes in case transient or intermittent delivery failures occur.

如果由于与特殊用途邮箱的存在无关的原因,无法将其传递到特殊用途邮箱,则筛选解释器随后不得尝试在指定的默认邮箱中进行传递,作为回退。相反,如果“:specialuse”参数不存在并且传递到由其位置参数命名的邮箱失败,则它必须完全按照它所做的操作进行。这可以防止在发生瞬时或间歇性传递故障时邮件意外地分布在两个邮箱上的情况。

4.1. Mailboxes Created Implicitly by the "fileinto" Command
4.1. 通过“fileinto”命令隐式创建的邮箱

Before attempting to deliver the message into the specified mailbox, the "fileinto" command may implicitly create the mailbox if it does not exist (see Section 4.1 of RFC 5228 [SIEVE]). This optional behavior can be requested explicitly using the "mailbox" extension [SIEVE-MAILBOX], which adds the optional ":create" argument to the "fileinto" command. If the ":create" argument is specified with "fileinto", it instructs the Sieve interpreter to unconditionally create the specified mailbox if needed. Note that the ":create" argument has no effect when the implicit creation of mailboxes for delivery is the default behavior.

在尝试将邮件传递到指定邮箱之前,如果邮箱不存在,“fileinto”命令可能会隐式创建邮箱(请参阅RFC 5228[SIEVE]第4.1节)。可以使用“邮箱”扩展名[SIEVE-mailbox]显式请求此可选行为,该扩展将可选的“:create”参数添加到“fileinto”命令中。如果“:create”参数用“fileinto”指定,它将指示Sieve解释器在需要时无条件地创建指定的邮箱。请注意,当默认行为是隐式创建用于传递的邮箱时,“:create”参数无效。

When the ":specialuse" argument is present, this behavior does not change; the Sieve interpreter will implicitly create the specified default mailbox if needed. This need arises when both the special-use mailbox and the default mailbox are not found.

当“:specialuse”参数存在时,此行为不会改变;如果需要,Sieve解释器将隐式创建指定的默认邮箱。当特殊用途邮箱和默认邮箱都找不到时,就会出现这种需要。

If the server implementation supports the CREATE-SPECIAL-USE capability [SPECIAL-USE] for IMAP (i.e., it allows assigning special-use attributes to new mailboxes), it SHOULD assign the special-use attribute specified with the ":specialuse" argument to the newly created mailbox.

如果服务器实现支持IMAP的CREATE-SPECIAL-USE功能[SPECIAL-USE](即,它允许为新邮箱分配特殊使用属性),则应将使用“:specialuse”参数指定的特殊使用属性分配给新创建的邮箱。

4.2. Equivalent IMAP Operations
4.2. 等效IMAP操作

To clarify, the following IMAP protocol examples show a sequence of [IMAP] commands that a client could send to perform an action without Sieve that is equivalent to the "fileinto" action with the ":specialuse" argument. The following Sieve script is assumed:

为了澄清这一点,以下IMAP协议示例显示了一系列[IMAP]命令,客户端可以发送这些命令来执行一个不带筛选的操作,该操作相当于带有“:specialuse”参数的“fileinto”操作。假设使用以下筛选脚本:

   require "fileinto";
   require "special-use";
        
   require "fileinto";
   require "special-use";
        
   fileinto :specialuse "\\Archive" "INBOX/Archive";
        
   fileinto :specialuse "\\Archive" "INBOX/Archive";
        

First, the client proceeds as in Section 3.1 to find out whether the indicated special-use attribute is assigned to any mailbox in the user's personal namespace. If a matching special-use mailbox is found, the message is delivered there using the IMAP APPEND command. If no matching special-use mailbox is found, the client attempts to deliver the message to the indicated default mailbox:

首先,客户机按照第3.1节中的步骤来确定指定的特殊用途属性是否分配给用户个人名称空间中的任何邮箱。如果找到匹配的专用邮箱,则使用IMAP APPEND命令将邮件传递到该邮箱。如果未找到匹配的特殊用途邮箱,客户端将尝试将邮件传递到指定的默认邮箱:

   C: A04 APPEND INBOX/Archive {309}
   S: A04 NO [TRYCREATE] Mailbox does not exist: INBOX/Archive
        
   C: A04 APPEND INBOX/Archive {309}
   S: A04 NO [TRYCREATE] Mailbox does not exist: INBOX/Archive
        

In this example, the default mailbox does not exist either. In that case, the client MAY create the default mailbox and assign the indicated special-use attribute to it:

在此示例中,默认邮箱也不存在。在这种情况下,客户端可以创建默认邮箱,并将指定的特殊用途属性分配给它:

   C: A05 CREATE INBOX/Archive (USE (\Archive))
   S: A05 OK Create completed
        
   C: A05 CREATE INBOX/Archive (USE (\Archive))
   S: A05 OK Create completed
        

Finally, the client completes the delivery:

最后,客户机完成交付:

   C: A06 APPEND INBOX/Archive {309}
   S: + OK
   C: Date: Wed, 18 Jul 2018 22:00:09 +0200
   C: From: mooch@owatagu.siam.example
   C: To: Fred Foobar <foobar@Blurdybloop.example>
   C: Subject: afternoon meeting
   C: Message-Id: <Q234234-01012222@owatagu.siam.example>
   C: MIME-Version: 1.0
   C: Content-Type: text/plain; charset=UTF-8
   C:
   C: Hi Fred, do you think we can meet again at 3:30 tomorrow?
   C:
   S: A06 OK [APPENDUID 1533375901 2312] Append completed.
        
   C: A06 APPEND INBOX/Archive {309}
   S: + OK
   C: Date: Wed, 18 Jul 2018 22:00:09 +0200
   C: From: mooch@owatagu.siam.example
   C: To: Fred Foobar <foobar@Blurdybloop.example>
   C: Subject: afternoon meeting
   C: Message-Id: <Q234234-01012222@owatagu.siam.example>
   C: MIME-Version: 1.0
   C: Content-Type: text/plain; charset=UTF-8
   C:
   C: Hi Fred, do you think we can meet again at 3:30 tomorrow?
   C:
   S: A06 OK [APPENDUID 1533375901 2312] Append completed.
        
5. Sieve Capability Strings
5. 筛分能力串

A Sieve implementation that defines the "specialuse_exists" test and the ":specialuse" argument for the "fileinto" command will advertise the capability string "special-use".

定义“specialuse_exists”测试和“fileinto”命令的“:specialuse”参数的Sieve实现将公布功能字符串“special use”。

6. Examples
6. 例子

The following example saves the message in the mailbox where messages deemed to be junk mail are held. This mailbox is identified using the "\Junk" special-use attribute. If no mailbox has this attribute assigned, the message is filed into the mailbox named "Spam". If the mailbox named "Spam" does not exist either, the result of this Sieve script is implementation dependent, e.g., it may trigger an error or the mailbox may be created implicitly.

以下示例将邮件保存在被视为垃圾邮件的邮件所在的邮箱中。此邮箱使用“\Junk”特殊用途属性标识。如果没有邮箱分配此属性,则将邮件归档到名为“垃圾邮件”的邮箱中。如果名为“垃圾邮件”的邮箱也不存在,则此筛选脚本的结果取决于实现,例如,它可能会触发错误,或者邮箱可能是隐式创建的。

   require "fileinto";
   require "special-use";
        
   require "fileinto";
   require "special-use";
        

fileinto :specialuse "\\Junk" "Spam";

fileinto:specialuse“\\Junk”“Spam”;

The following very similar example explicitly handles the case in which neither a "\Junk" special-use mailbox nor the "Spam" mailbox exists. In that case, a mailbox called "Spam" is created, and the message is stored there. Additionally, the "\Junk" special-use attribute may be assigned to it.

以下非常类似的示例明确处理既不存在“\Junk”特殊用途邮箱也不存在“Spam”邮箱的情况。在这种情况下,将创建一个名为“垃圾邮件”的邮箱,并将邮件存储在该邮箱中。此外,还可以为其指定“\Junk”特殊用途属性。

   require "fileinto";
   require "special-use";
   require "mailbox";
        
   require "fileinto";
   require "special-use";
   require "mailbox";
        
   fileinto :specialuse "\\Junk" :create "Spam";
        
   fileinto :specialuse "\\Junk" :create "Spam";
        

The following example is used in a Sieve script that is triggered from an IMAP event rather than at message delivery [IMAPSIEVE]. This Sieve script redirects messages to an automated recipient that processes junk mail if those messages are copied or moved into a mailbox that has the "\Junk" special-use attribute assigned.

以下示例用于从IMAP事件而不是在消息传递[IMAPSIEV]时触发的筛选脚本。如果将邮件复制或移动到指定了“\junk”特殊用途属性的邮箱中,此筛选脚本会将邮件重定向到处理垃圾邮件的自动收件人。

   require "imapsieve";
   require "special-use";
   require "environment";
   require "variables";
        
   require "imapsieve";
   require "special-use";
   require "environment";
   require "variables";
        
   if environment :contains "imap.mailbox" "*" {
       set "mailbox" "${1}";
   }
        
   if environment :contains "imap.mailbox" "*" {
       set "mailbox" "${1}";
   }
        
   if allof(
       environment "imap.cause" "COPY",
       specialuse_exists "${mailbox}" "\\Junk") {
       redirect "spam-report@example.org";
   }
        
   if allof(
       environment "imap.cause" "COPY",
       specialuse_exists "${mailbox}" "\\Junk") {
       redirect "spam-report@example.org";
   }
        
7. Security Considerations
7. 安全考虑

Security considerations are discussed in [SIEVE], [VARIABLES], and [SPECIAL-USE]. It is believed that this extension does not introduce any additional security concerns.

安全注意事项在[筛选]、[变量]和[特殊用途]中讨论。据信,这一扩展不会带来任何额外的安全问题。

Note that this specification explicitly restricts the special-use mailbox to the user's personal namespace. First, this avoids the need to search the entire mail storage for mailboxes that have a particular special-use attribute assigned. This could put undue load on the system, while shared special-use mailboxes are deemed of limited use with the currently defined special-use attributes. Secondly, it prevents security concerns with shared mailboxes that have special-use attributes assigned that apply to all users. Searching the entire mail storage for special-use mailboxes could lead to messages unexpectedly or even maliciously being filed to shared mailboxes.

请注意,此规范明确将特殊用途邮箱限制为用户的个人命名空间。首先,这避免了在整个邮件存储中搜索指定了特定特殊用途属性的邮箱的需要。这可能会给系统带来不适当的负载,而共享特殊用途邮箱被视为具有当前定义的特殊用途属性的有限用途。第二,它防止了共享邮箱的安全问题,这些邮箱分配了适用于所有用户的特殊使用属性。在整个邮件存储中搜索特殊用途邮箱可能会导致邮件意外甚至恶意地归档到共享邮箱。

This restriction could be lifted for particular future special-use attributes, but such new attributes should have a clear application for shared mailboxes, and the security concerns should be considered carefully.

对于特定的未来特殊用途属性,可以取消此限制,但此类新属性应具有用于共享邮箱的明确应用程序,并且应仔细考虑安全问题。

8. IANA Considerations
8. IANA考虑

IANA has registered the Sieve extension specified in this document in the "Sieve Extensions" registry at <https://www.iana.org/assignments/ sieve-extensions>:

IANA已在“筛网扩展”注册表中注册了本文件中指定的筛网扩展<https://www.iana.org/assignments/ 筛网扩展>:

Capability name: special-use Description: adds a test for checking whether an IMAP special-use attribute is assigned for a particular mailbox or any mailbox; also adds the ability to file messages into a mailbox identified solely by a special-use attribute. RFC number: RFC 8579 Contact address: Sieve discussion list <sieve@ietf.org>

功能名称:特殊用途说明:添加一个测试,用于检查是否为特定邮箱或任何邮箱分配了IMAP特殊用途属性;还可以将邮件归档到仅由特殊用途属性标识的邮箱中。RFC编号:RFC 8579联系地址:筛讨论列表<sieve@ietf.org>

9. References
9. 工具书类
9.1. Normative References
9.1. 规范性引用文件

[IMAP-METADATA] Daboo, C., "The IMAP METADATA Extension", RFC 5464, DOI 10.17487/RFC5464, February 2009, <https://www.rfc-editor.org/info/rfc5464>.

[IMAP-METADATA]Daboo,C.,“IMAP元数据扩展”,RFC 5464,DOI 10.17487/RFC5464,2009年2月<https://www.rfc-editor.org/info/rfc5464>.

[KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.

[关键词]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,DOI 10.17487/RFC2119,1997年3月<https://www.rfc-editor.org/info/rfc2119>.

[KEYWORDS-UPD] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.

[KEYWORDS-UPD]Leiba,B.,“RFC 2119关键词中大写与小写的歧义”,BCP 14,RFC 8174,DOI 10.17487/RFC8174,2017年5月<https://www.rfc-editor.org/info/rfc8174>.

[NAMESPACE] Gahrns, M. and C. Newman, "IMAP4 Namespace", RFC 2342, DOI 10.17487/RFC2342, May 1998, <https://www.rfc-editor.org/info/rfc2342>.

[名称空间]Gahrns,M.和C.Newman,“IMAP4名称空间”,RFC 2342,DOI 10.17487/RFC2342,1998年5月<https://www.rfc-editor.org/info/rfc2342>.

[SIEVE] Guenther, P., Ed. and T. Showalter, Ed., "Sieve: An Email Filtering Language", RFC 5228, DOI 10.17487/RFC5228, January 2008, <https://www.rfc-editor.org/info/rfc5228>.

[SIEVE]Guenther,P.,Ed.和T.Showalter,Ed.,“SIEVE:电子邮件过滤语言”,RFC 5228,DOI 10.17487/RFC5228,2008年1月<https://www.rfc-editor.org/info/rfc5228>.

[SIEVE-MAILBOX] Melnikov, A., "The Sieve Mail-Filtering Language -- Extensions for Checking Mailbox Status and Accessing Mailbox Metadata", RFC 5490, DOI 10.17487/RFC5490, March 2009, <https://www.rfc-editor.org/info/rfc5490>.

[筛网邮箱]Melnikov,A.,“筛网邮件过滤语言——检查邮箱状态和访问邮箱元数据的扩展”,RFC 5490,DOI 10.17487/RFC5490,2009年3月<https://www.rfc-editor.org/info/rfc5490>.

[SPECIAL-USE] Leiba, B. and J. Nicolson, "IMAP LIST Extension for Special-Use Mailboxes", RFC 6154, DOI 10.17487/RFC6154, March 2011, <https://www.rfc-editor.org/info/rfc6154>.

[特殊用途]Leiba,B.和J.Nicolson,“特殊用途邮箱的IMAP列表扩展”,RFC 6154,DOI 10.17487/RFC6154,2011年3月<https://www.rfc-editor.org/info/rfc6154>.

[VARIABLES] Homme, K., "Sieve Email Filtering: Variables Extension", RFC 5229, DOI 10.17487/RFC5229, January 2008, <https://www.rfc-editor.org/info/rfc5229>.

[VARIABLES]Homme,K.,“筛选电子邮件过滤:变量扩展”,RFC 5229,DOI 10.17487/RFC5229,2008年1月<https://www.rfc-editor.org/info/rfc5229>.

9.2. Informative References
9.2. 资料性引用

[IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003, <https://www.rfc-editor.org/info/rfc3501>.

[IMAP]Crispin,M.,“互联网消息访问协议-版本4rev1”,RFC 3501,DOI 10.17487/RFC3501,2003年3月<https://www.rfc-editor.org/info/rfc3501>.

[IMAP-ACL] Melnikov, A., "IMAP4 Access Control List (ACL) Extension", RFC 4314, DOI 10.17487/RFC4314, December 2005, <https://www.rfc-editor.org/info/rfc4314>.

[IMAP-ACL]Melnikov,A.,“IMAP4访问控制列表(ACL)扩展”,RFC 4314,DOI 10.17487/RFC4314,2005年12月<https://www.rfc-editor.org/info/rfc4314>.

[IMAPSIEVE] Leiba, B., "Support for Internet Message Access Protocol (IMAP) Events in Sieve", RFC 6785, DOI 10.17487/RFC6785, November 2012, <https://www.rfc-editor.org/info/rfc6785>.

[IMAPSIEVE]Leiba,B.,“互联网消息访问协议(IMAP)事件在Sieve中的支持”,RFC 6785,DOI 10.17487/RFC67852012年11月<https://www.rfc-editor.org/info/rfc6785>.

[LIST-EXTENDED] Leiba, B. and A. Melnikov, "Internet Message Access Protocol version 4 - LIST Command Extensions", RFC 5258, DOI 10.17487/RFC5258, June 2008, <https://www.rfc-editor.org/info/rfc5258>.

[列表扩展]Leiba,B.和A.Melnikov,“互联网消息访问协议第4版-列表命令扩展”,RFC 5258,DOI 10.17487/RFC5258,2008年6月<https://www.rfc-editor.org/info/rfc5258>.

Acknowledgements

致谢

Thanks to Stan Kalisch, Barry Leiba, Alexey Melnikov, Ken Murchison, and Ned Freed for reviews and suggestions.

感谢斯坦·卡利什、巴里·莱巴、阿列克谢·梅尔尼科夫、肯·默奇森和内德·弗里德的评论和建议。

Thanks to the authors of RFC 5490 [SIEVE-MAILBOX], from which some descriptive text in this document is borrowed.

感谢RFC 5490[SIVE-MAILBOX]的作者,本文档中的一些描述性文本是从RFC 5490中借来的。

Author's Address

作者地址

Stephan Bosch Open Xchange Oy Lars Sonckin kaari 12 Espoo 02600 Finland

Stephan Bosch开放式交易所Oy Lars Sonckin kaari 12 Espoo 02600芬兰

   Email: stephan.bosch@open-xchange.com
        
   Email: stephan.bosch@open-xchange.com