使用邮件流规则筛选Exchange Online中的批量电子邮件

在没有Exchange Online邮箱的Exchange Online组织或独立Exchange Online Protection (EOP) 组织中,反垃圾邮件策略 ((也称为垃圾邮件筛选策略或内容筛选器策略)) 扫描入站邮件中的垃圾邮件和批量邮件 (也称为灰色邮件) 。 有关详细信息,请参阅在 EOP 中配置反垃圾邮件策略

如果需要更多选项来筛选批量邮件,可以创建邮件流规则 (也称为传输规则) 搜索在批量邮件中经常发现的文本模式或短语,并将这些邮件标记为垃圾邮件。 有关批量邮件的详细信息,请参阅 垃圾邮件和批量电子邮件之间的区别?EOP 中 BCL) (批量投诉级别

本主题说明如何在 Exchange 管理中心创建这些邮件流规则, (EAC) 和 PowerShell (Exchange Online PowerShell for Microsoft 365 组织的邮箱位于 Exchange Online 中;对于没有Exchange Online邮箱) 的组织的独立 EOP PowerShell。

开始前,有必要了解什么?

使用 EAC 创建筛选批量电子邮件的邮件流规则

  1. 在 EAC 中,转到 “邮件流>规则”。

  2. 选择“ + 添加规则 ”,然后选择“ 创建新规则”。

  3. 在打开的 “设置规则条件 ”页中,配置以下设置:

    • 名称:输入规则的唯一描述性名称。

    • 在以下情况下应用此规则:配置以下设置之一,以使用正则表达式 (正则表达式) 或字词或短语查找邮件中的内容:

      • 主题或正文>主题或正文与这些文本模式匹配:在出现的“ 指定字词或短语 ”对话框中,输入以下值之一,选择“ 添加”,然后重复,直到输入所有值。

        • If you are unable to view the content of this email\, please
        • \>(safe )?unsubscribe( here)?\</a\>
        • If you do not wish to receive further communications like this\, please
        • <img height="?1"? width="?1"? src=.?http\://
        • To stop receiving these+emails\:http\://
        • To unsubscribe from \w+ (e\-?letter|e?-?mail|newsletter)
        • no longer (wish )?(to )?(be sent|receive) w+ email
        • If you are unable to view the content of this email\, please click here
        • To ensure you receive (your daily deals|our e-?mails)\, add
        • If you no longer wish to receive these emails
        • to change your (subscription preferences|preferences or unsubscribe)
        • click (here to|the) unsubscribe

      若要编辑条目,请选择该条目,然后选择 “编辑”图标。 若要删除条目,请选择该条目,然后选择“ 删除”图标

      完成后,选择“保存”

      • 主题或正文>主题或正文包括以下任何字词:在出现的 “指定字词或短语 ”对话框中,输入以下值之一,选择“ 添加”,然后重复,直到输入所有值。

        • to change your preferences or unsubscribe
        • Modify email preferences or unsubscribe
        • This is a promotional email
        • You are receiving this email because you requested a subscription
        • click here to unsubscribe
        • You have received this email because you are subscribed
        • If you no longer wish to receive our email newsletter
        • to unsubscribe from this newsletter
        • If you have trouble viewing this email
        • This is an advertisement
        • you would like to unsubscribe or change your
        • view this email as a webpage
        • You are receiving this email because you are subscribed

      若要编辑条目,请选择该条目,然后选择 “编辑”图标。 若要删除条目,请选择该条目,然后选择“ 删除”图标

      完成后,选择“保存”

    • 执行以下操作:选择“修改邮件属性>”, (SCL) 设置垃圾邮件置信度级别。 在出现的“ 指定 SCL ”对话框中,配置以下设置之一:

      • 若要将邮件标记为 垃圾邮件,请选择 6。 在反垃圾邮件策略中为垃圾邮件筛选判决配置的操作将应用于邮件, (默认值为将邮件移动到垃圾邮件Email文件夹) 。

      • 若要将邮件标记为 “高置信度垃圾邮件”,请选择 “9”。 在反垃圾邮件策略中为高置信度垃圾邮件筛选裁定配置的操作将应用于邮件, (默认值为将邮件移动到垃圾邮件Email文件夹) 。

    有关 SCL 值的详细信息,请参阅 EOP 中的垃圾邮件置信度 (SCL)

    完成后,选择“保存”

使用 PowerShell 创建筛选批量电子邮件的邮件流规则

使用以下语法创建一个或两个邮件流规则 (正则表达式和单词) :

New-TransportRule -Name "<UniqueName>" [-SubjectOrBodyMatchesPatterns "<RegEx1>","<RegEx2>"...] [-SubjectOrBodyContainsWords "<WordOrPhrase1>","<WordOrPhrase2>"...] -SetSCL <6 | 9>

以下示例创建一个名为“批量电子邮件筛选 - 正则表达式”的新规则,该规则使用本主题前面所述的相同正则表达式列表将邮件设置为 垃圾邮件

New-TransportRule -Name "Bulk email filtering - RegEx" -SubjectOrBodyMatchesPatterns "If you are unable to view the content of this email\, please","\>(safe )?unsubscribe( here)?\</a\>","If you do not wish to receive further communications like this\, please","\<img height\="?1"? width\="?1"? src=.?http\://","To stop receiving these+emails\:http\://","To unsubscribe from \w+ (e\-?letter|e?-?mail|newsletter)","no longer (wish )?(to )?(be sent|receive) w+ email","If you are unable to view the content of this email\, please click here","To ensure you receive (your daily deals|our e-?mails)\, add","If you no longer wish to receive these emails","to change your (subscription preferences|preferences or unsubscribe)","click (here to|the) unsubscribe"... -SetSCL 6

以下示例创建名为“批量电子邮件筛选 - 字词”的新规则,该规则使用主题前面相同的单词列表将邮件设置为 高置信度垃圾邮件

New-TransportRule -Name "Bulk email filtering - Words" -SubjectOrBodyContainsWords "to change your preferences or unsubscribe","Modify email preferences or unsubscribe","This is a promotional email","You are receiving this email because you requested a subscription","click here to unsubscribe","You have received this email because you are subscribed","If you no longer wish to receive our email newsletter","to unsubscribe from this newsletter","If you have trouble viewing this email","This is an advertisement","you would like to unsubscribe or change your","view this email as a webpage","You are receiving this email because you are subscribed" -SetSCL 9

有关语法和参数的详细信息,请参阅 New-TransportRule

如何判断是否生效?

若要验证是否已将邮件流规则配置为筛选批量电子邮件,请执行以下步骤:

  • 在 EAC 中,转到“邮件流>规则>”,选择“编辑”图标的规则>,选择“设置”选项卡,然后验证设置。

  • 在 PowerShell 中,将“规则名称”>替换为<规则的名称,并运行以下命令来验证设置:

    Get-TransportRule -Identity "<Rule Name>" | Format-List
    
  • 从外部帐户向受影响的收件人发送包含其中一个短语或文本模式的测试邮件,并验证结果。