Exchange Online 中的邮件流规则(传输规则)Mail flow rules (transport rules) in Exchange Online

可以使用邮件流规则(也称为传输规则)识别通过 Office 365 组织进行传递的邮件并对其进行操作。邮件流规则与 Outlook 和 Web 上的 Outlook 中提供的收件箱规则类似。主要区别在于邮件流规则在邮件传输过程中对其进行操作,而不是在邮件传递到邮箱后进行操作。邮件流规则包含更丰富的条件、例外和操作集,让你能灵活实现多种类型的邮件策略。You can use mail flow rules (also known as transport rules) to identify and take action on messages that flow through your Office 365 organization. Mail flow rules are similar to the Inbox rules that are available in Outlook and Outlook on the web. The main difference is mail flow rules take action on messages while they're in transit, and not after the message is delivered to the mailbox. Mail flow rules contain a richer set of conditions, exceptions, and actions, which provides you with the flexibility to implement many types of messaging policies.

本文介绍了邮件流规则的组件其工作方式This article explains the components of mail flow rules, and how they work.

步骤创建、 复制和管理邮件流规则,请参阅管理邮件流规则。对于每个规则,您可以强制实施该、 测试,或测试和通知发件人的选择。若要了解有关测试选项的详细信息,请参阅测试邮件流规则策略提示For steps to create, copy, and manage mail flow rules, see Manage mail flow rules. For each rule, you have the option of enforcing it, testing it, or testing it and notifying the sender. To learn more about the testing options, see Test a mail flow rule and Policy Tips.

有关与邮件流规则匹配的邮件的摘要和详细信息报告,请参阅使用 Office 365 中的邮件保护报告查看关于恶意软件、垃圾邮件和规则检测的数据For summary and detail reports about messages that matched mail flow rules, see Use mail protection reports in Office 365 to view data about malware, spam, and rule detections.

若要通过使用邮件流规则实现特定的邮件策略,请参阅下列主题:To implement specific messaging policies by using mail flow rules, see these topics:

邮件流规则组件Mail flow rule components

邮件流规则由条件、例外、操作和属性组成:A mail flow rule is made of conditions, exceptions, actions, and properties:

  • 条件 用于标识要将操作应用到的邮件。一些条件检查邮件头字段(例如"收件人"、"发件人"或"抄送"字段)。其他条件检查邮件属性(例如邮件主题、正文、附件、邮件大小或邮件分类)。大多数条件要求你指定比较运算符(例如等于、不等于或包含)以及要匹配的值。如果没有条件或例外,规则将应用到所有邮件。Conditions Identify the messages that you want to apply the actions to. Some conditions examine message header fields (for example, the To, From, or Cc fields). Other conditions examine message properties (for example, the message subject, body, attachments, message size, or message classification). Most conditions require you to specify a comparison operator (for example, equals, doesn't equal, or contains) and a value to match. If there are no conditions or exceptions, the rule is applied to all messages.

    有关邮件流规则条件在 Exchange Online,请参阅Mail flow 规则条件和例外 (predicates) 在 Exchange OnlineFor more information about mail flow rule conditions in Exchange Online, see Mail flow rule conditions and exceptions (predicates) in Exchange Online.

  • 例外 选择性地识别操作不应应用到的邮件。条件中可用的相同邮件标识符同样在例外中可用。例外会覆盖条件并阻止规则操作应用于邮件,即使邮件匹配所有配置的条件也是如此。Exceptions Optionally identify the messages that the actions shouldn't apply to. The same message identifiers that are available in conditions are also available in exceptions. Exceptions override conditions and prevent the rule actions from being applied to a message, even if the message matches all of the configured conditions.

  • 操作 指定对匹配规则中的条件而不匹配任何例外的邮件执行哪些操作。有许多可用操作,例如拒绝、删除或重定向邮件、添加其他收件人、在邮件主题中添加前缀或在邮件正文中插入免责声明。Actions Specify what to do to messages that match the conditions in the rule, and don't match any of the exceptions. There are many actions available, such as rejecting, deleting, or redirecting messages, adding additional recipients, adding prefixes in the message subject, or inserting disclaimers in the message body.

    有关详细信息可在 Exchange Online 的规则操作的邮件流,请参阅联机在 Exchange 规则操作的邮件流For more information about mail flow rule actions that are available in Exchange Online, see Mail flow rule actions in Exchange Online.

  • 属性 指定条件、例外和操作之外的其他规则设置。例如,应何时应用规则、是否强制实施或测试规则,以及规则可用的时间段。Properties Specify other rules settings that aren't conditions, exceptions or actions. For example, when the rule should be applied, whether to enforce or test the rule, and the time period when the rule is active.

    有关详细信息,请参阅本主题中的 邮件流规则属性部分。For more information, see the Mail flow rule properties section in this topic.

多个条件、例外和操作Multiple conditions, exceptions, and actions

下表显示了在规则中处理的多个条件、条件值、例外和操作。The following table shows how multiple conditions, condition values, exceptions, and actions are handled in a rule.

组件Component 逻辑Logic 注释Comments
多个条件Multiple conditions
ANDAND
邮件必须匹配该规则的所有条件。如果需要匹配一个条件或另一个条件,请对每个条件使用不同的规则。例如,如果要为带有附件的邮件和包含指定文本的邮件添加相同的免责声明,请为每个条件创建一个规则。在 EAC 中,你可以轻松地复制规则。A message must match all the conditions in the rule. If you need to match one condition or another, use separate rules for each condition. For example, if you want to add the same disclaimer to messages with attachments and messages that contain specific text, create one rule for each condition. In the EAC, you can easily copy a rule.
一个条件具有多个值One condition with multiple values
OROR
一些条件允许你指定多个值。邮件必须匹配任一(并非全部)指定值。例如,如果电子邮件的主题为 Stock price information,并且 主题包含这些词中的任一个条件被配置为匹配单词 Contoso 或 stock,则符合该条件,因为主题中至少包含指定值中的一个。 Some conditions allow you to specify more than one value. The message must match any one (not all) of the specified values. For example, if an email message has the subject Stock price information, and the The subject includes any of these words condition is configured to match the words Contoso or stock, the condition is satisfied because the subject contains at least one of the specified values.
多个例外Multiple exceptions
OROR
如果邮件匹配任何例外,则操作不会应用到邮件。该邮件不需要匹配所有例外。If a message matches any one of the exceptions, the actions are not applied to the message. The message doesn't have to match all the exceptions.
多个操作Multiple actions
ANDAND
匹配规则条件的邮件获取规则中指定的所有操作。例如,如果选择了操作" 在邮件主题前面追加"和" 将收件人添加到密件抄送框",则两种操作都将应用至邮件。 Messages that match a rule's conditions get all the actions that are specified in the rule. For example, if the actions Prepend the subject of the message with and Add recipients to the Bcc box are selected, both actions are applied to the message.
请记住,某些操作,如删除消息,而不通知任何人操作,可防止后续规则应用于邮件。例如,将邮件转发其他操作不允许其他操作。Keep in mind that some actions, such as the Delete the message without notifying anyone action, prevent subsequent rules from being applied to a message. Other actions such as Forward the message do not allow additional actions.
还可以为规则设置操作,以便在应用该规则时,后续规则不会应用至邮件。You can also set an action on a rule so that when that rule is applied, subsequent rules are not applied to the message.

邮件流规则属性Mail flow rule properties

下表介绍了邮件流规则中所提供的规则属性。The following table describes the rule properties that are available in mail flow rules.

EAC 中的属性名称Property name in the EAC PowerShell 中的参数名称Parameter name in PowerShell 说明Description
优先级Priority
PriorityPriority
指示规则应用于邮件的顺序。默认优先级基于规则创建的先后顺序(较早规则的优先级高于较新规则的优先级,先处理具有较高优先级的规则,然后再处理具有较低优先级的规则)。 Indicates the order that the rules are applied to messages. The default priority is based on when the rule is created (older rules have a higher priority than newer rules, and higher priority rules are processed before lower priority rules).
通过在规则列表中上移或下移规则可更改 EAC 中规则的优先级。在 PowerShell中,可设置优先级编号(0 表示最高优先级)。 You change the rule priority in the EAC by moving the rule up or down in the list of rules. In the PowerShell, you set the priority number (0 is the highest priority).
例如,如果有一个拒绝包含信用卡号码的邮件的规则,还有一个需要批准的规则,你希望拒绝规则先发生,并停止应用其他规则。For example, if you have one rule to reject messages that include a credit card number, and another one requiring approval, you'll want the reject rule to happen first, and stop applying other rules.
有关详细信息,请参阅设置邮件流规则的优先级For more information, see Set the priority of a mail flow rule.
模式Mode
ModeMode
可以指定是否让规则立即处理邮件,或是否在不影响邮件传递(启用或不启用数据丢失防护或 DLP 策略提示)的情况下测试规则。You can specify whether you want the rule to start processing messages immediately, or whether you want to test rules without affecting the delivery of the message (with or without Data Loss Prevention or DLP Policy Tips).
策略提示在 Outlook 或 Web 上的 Outlook 中显示简短说明,该说明可提供有关邮件创建者可能违反策略的信息。有关详细信息,请参阅策略提示Policy Tips present a brief note in Outlook or Outlook on the web that provides information about possible policy violations to the person that's creating the message. For more information, see Policy Tips.
有关模式的详细信息,请参阅 Test a mail flow ruleFor more information about the modes, see Test a mail flow rule.
在以下日期激活此规则Activate this rule on the following date
在以下日期停用此规则Deactivate this rule on the following date
ActivationDateActivationDate
ExpiryDateExpiryDate
指定启用该规则的日期范围。Specifies the date range when the rule is active.
选中或未选中 On 复选框On check box selected or not selected
新规则: New-TransportRule cmdlet 中的 Enabled 参数。New rules: Enabled parameter on the New-TransportRule cmdlet.
现有规则:使用 Enable-TransportRuleDisable-TransportRule cmdlet。Existing rules: Use the Enable-TransportRule or Disable-TransportRule cmdlets.
该值显示在规则的 State 属性中。The value is displayed in the State property of the rule.
可以创建一个禁用规则,并在准备测试它时将其启用。或者,在不删除该规则的情况下将其禁用,以保留设置。You can create a disabled rule, and enable it when you're ready to test it. Or, you can disable a rule without deleting it to preserve the settings.
如果规则处理未完成,则延迟邮件Defer the message if rule processing doesn't complete
RuleErrorActionRuleErrorAction
如果无法完成规则处理,可以指定邮件的处理方式。默认情况下,系统将忽略该规则,但可以选择重新提交邮件进行处理。You can specify how the message should be handled if the rule processing can't be completed. By default, the rule will be ignored, but you can choose to resubmit the message for processing.
匹配邮件中的发件人地址Match sender address in message
SenderAddressLocationSenderAddressLocation
如果规则使用检查发件人的电子邮件地址的条件或例外,则可以在邮件标头、 邮件信封或同时在两者中查找该值。If the rule uses conditions or exceptions that examine the sender's email address, you can look for the value in the message header, the message envelope, or both.
停止处理更多规则Stop processing more rules
SenderAddressLocationSenderAddressLocation
这是一种规则操作,但它看起来像 EAC 中的属性。你可以选择在规则处理完某个邮件后,停止向邮件应用其他规则。This is an action for the rule, but it looks like a property in the EAC. You can choose to stop applying additional rules to a message after a rule processes a message.
注释Comments
CommentsComments
可以输入有关规则的描述性注释。You can enter descriptive comments about the rule.

如何将邮件流规则应用于邮件How mail flow rules are applied to messages

根据您的组织中已启用的邮件流规则计算流通过您的组织的所有邮件。规则中的邮件流上列出的顺序进行处理>规则页面在 EAC 中,或基于在 PowerShell 中相应的_优先级_参数值。All messages that flow through your organization are evaluated against the enabled mail flow rules in your organization. Rules are processed in the order listed on the Mail flow > Rules page in EAC, or based on the corresponding Priority parameter value in the PowerShell.

每个规则还提供在规则匹配时停止处理其他规则的选项。此设置对于匹配多个邮件流规则中条件的邮件而言非常重要(想要哪个规则应用于邮件?全部?还是一个?)。Each rule also offers the option of stopping processing more rules when the rule is matched. This setting is important for messages that match the conditions in multiple mail flow rules (which rule do you want applied to the message? All? Just one?).

基于消息类型处理的差异Differences in processing based on message type

通过组织进行传递的邮件有几种类型。下表显示了哪些邮件类型可以通过邮件流规则进行处理。There are several types of messages that pass through an organization. The following table shows which messages types can be processed by mail flow rules.


消息类型Type of message 是否可以应用规则?Can a rule be applied?
常规邮件 包含单个富文本格式 (RTF)、HTML、纯文本邮件正文、多部分或备用的邮件正文集的邮件。Regular messages Messages that contain a single rich text format (RTF), HTML, or plain text message body or a multipart or alternative set of message bodies.
Yes
Office 365 邮件加密 ** 邮件通过 Office 365 中的 Office 365 邮件加密 进行加密。有关详细信息,请参阅 Office 365 邮件加密Office 365 Message Encryption ** Messages encrypted by Office 365 Message Encryption in Office 365. For more information, see Office 365 Message Encryption.
规则可始终根据检查这些标头的条件来访问信封头并处理邮件。Rules can always access envelope headers and process messages based on conditions that inspect those headers.
对于检查或修改加密邮件内容的规则,需要验证是否启用了传输解密(强制或可选;默认为可选)。有关详细信息,请参阅 Enable or disable transport decryption(启用或禁用传输解密)。 For a rule to inspect or modify the contents of an encrypted message, you need to verify that transport decryption is enabled (Mandatory or Optional; the default is Optional). For more information, see Enable or disable transport decryption.
还可以创建规则,自动解密加密邮件。有关详细信息,请参阅为加密或解密电子邮件定义规则You can also create a rule that automatically decrypts encrypted messages. For more information, see Define rules to encrypt or decrypt email messages.
S/MIME 加密邮件S/MIME encrypted messages
规则仅可根据检查这些标头的条件来访问信封头并处理邮件。Rules can only access envelope headers and process messages based on conditions that inspect those headers.
无法处理具有需要检查邮件内容的条件的规则或可以修改邮件内容的操作。Rules with conditions that require inspection of the message's content, or actions that modify the message's content can't be processed.
RMS 保护的邮件 应用 Active Directory Rights Management Services (AD RMS) 或 Azure 权限管理 (RMS) 策略的邮件。RMS protected messages Messages that had an Active Directory Rights Management Services (AD RMS) or Azure Rights Management (RMS) policy applied.
规则可始终根据检查这些标头的条件来访问信封头并处理邮件。Rules can always access envelope headers and process messages based on conditions that inspect those headers.
对于检查或修改 RMS 保护的邮件内容的规则,需要验证是否启用了传输解密(强制或可选;默认为可选)。有关详细信息,请参阅 Enable or disable transport decryption(启用或禁用传输解密)。 For a rule to inspect or modify the contents of an RMS protected message, you need to verify that transport decryption is enabled (Mandatory or Optional; the default is Optional). For more information, see Enable or disable transport decryption.
已明文签名的邮件 已签名但未加密的邮件。Clear-signed messages Messages that have been signed but not encrypted.
Yes
UM 邮件 由统一消息服务创建或处理的邮件,如语音邮件、传真、未接来电通知以及使用 Microsoft Outlook Voice Access 创建或转发的邮件。UM messages Messages that are created or processed by the Unified Messaging service, such as voice mail, fax, missed call notifications, and messages created or forwarded by using Microsoft Outlook Voice Access.
Yes
匿名邮件 由匿名发件人发送的邮件。Anonymous messages Messages sent by anonymous senders.
Yes
读取报告 为响应发件人的阅读回执请求而生成的报告。读取报告具有邮件类别 IPM.Note*.MdnReadIPM.Note*.MdnNotReadRead reports Reports that are generated in response to read receipt requests by senders. Read reports have a message class of IPM.Note*.MdnRead or IPM.Note*.MdnNotRead.
Yes

我还应该知道些什么?What else should I know?

  • 规则的版本RuleVersion属性值并不重要 in Exchange Online。The Version or RuleVersion property value for a rule isn't important in Exchange Online.

  • 创建或修改的邮件流规则之后,,可能需要 30 分钟的时间要应用于邮件的新的或更新规则。After you create or modify a mail flow rule, it can take up to 30 minutes for the new or updated rule to be applied to messages.

详细信息For more information

管理邮件流规则Manage mail flow rules

Use mail flow rules to inspect message attachments in Office 365Use mail flow rules to inspect message attachments in Office 365

Organization-wide Disclaimers, Signatures, Footers, or HeadersOrganization-wide Disclaimers, Signatures, Footers, or Headers

Manage message approvalManage message approval

邮件流规则过程在 Exchange OnlineMail flow rule procedures in Exchange Online

传输和收件箱规则限制Transport and Inbox rule limits