使用郵件流程規則來篩選 Exchange Online 中的大量電子郵件

在 Exchange Online 組織或獨立 Exchange Online Protection (EOP) 沒有 Exchange Online 信箱的組織中,反垃圾郵件原則 (也稱為垃圾郵件篩選原則或內容篩選原則,) 掃描垃圾郵件和大量郵件 (也稱為灰色郵件) 。 如需詳細資訊,請參閱在 EOP 中設定反垃圾郵件原則

如果您想要更多選項來篩選大量郵件,您可以建立郵件流程規則 (也稱為傳輸規則) 搜尋大量郵件中經常找到的文字模式或片語,並將這些郵件標示為垃圾郵件。 如需大量郵件的詳細資訊,請參閱 垃圾郵件與大量電子郵件之間的差異為何? 以及 EOP 中的大量抱怨層級 (BCL)

本主題說明如何在 Exchange 系統管理中心建立這些郵件流程規則, (EAC) 和 PowerShell (Exchange Online PowerShell for Microsoft 365 組織,其信箱位於 Exchange Online;獨立 EOP PowerShell 適用於沒有 Exchange Online 信箱) 的組織。

開始之前有哪些須知?

使用 EAC 建立篩選大量電子郵件的郵件流程規則

  1. 在 EAC 中,移至 [郵件流程>規則]

  2. 取 [+ 新增規則] ,然後選取 [ 建立新規則]

  3. 在開啟的 [ 設定規則條件 ] 頁面中,設定下列設定:

    • 名稱:輸入規則的唯一描述性名稱。

    • 如果:使用正則表示式 (RegEx) 或單字或片語,設定下列其中一個設定來尋找訊息中的內容,請套用此規則

      • 主旨或本文>主旨或本文符合這些文字模式:在出現的 [ 指定單字或片語 ] 對話框中,輸入下列其中一個值,選取 [ 新增],然後重複直到您輸入所有值為止。

        • 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>

下列範例會建立名為「大量電子郵件篩選 - RegEx」的新規則,該規則會使用本主題稍早的相同正則表示式清單,將郵件設定為 垃圾郵件

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
    
  • 從外部帳戶,將測試訊息傳送給包含其中一個片語或文字模式的受影響收件者,並確認結果。