使用郵件流程規則來篩選 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 信箱) 的組織。
開始之前有哪些須知?
您必須先獲指派 Exchange Online 或 EOP 中的許可權,才能執行本文中的程式。 具體而言,您需要依預設指派給組織管理、合規性管理 (全域管理員) 和記錄管理角色群組的傳輸規則角色。
如需詳細資訊,請參閱下列主題:
若要在 Exchange Online 中開啟 EAC,請參閱 Exchange Online 中的 Exchange 系統管理中心。 若要在獨立 EOP 中開啟 EAC,請參閱 獨立 EOP 中的 Exchange 系統管理中心。
若要連線至 Exchange Online PowerShell,請參閱連線至 Exchange Online PowerShell。 若要連接至獨立版 EOP PowerShell,請參閱連線到 Exchange Online Protection PowerShell。
如需 Exchange Online 和獨立 EOP 中郵件流程規則的詳細資訊,請參閱下列主題:
用來識別範例中大量郵件的單字和文字模式清單並不詳盡;您可以視需要新增和移除專案。 不過,這是不錯的起點。
在主旨或郵件的其他標頭欄位中搜尋字詞或文字模式,會發生在郵件已從 MIME 內容傳輸編碼方法進行解碼之後,該編碼方法用來在 SMTP 伺服器之間傳送 ASCII 文字二進位訊息。 您無法使用條件或例外狀況來搜尋原始 (,通常是Base 64) 訊息中主旨或其他標頭字段的編碼值。
下列程式會將大量訊息標示為整個組織的垃圾郵件。 不過,您可以新增另一個條件,只將這些規則套用至特定收件者,讓您可以對少數高度目標的使用者使用積極篩選,而其餘的使用者 (大部分取得他們註冊) 的大量電子郵件則不會受到影響。
使用 EAC 建立篩選大量電子郵件的郵件流程規則
在 EAC 中,移至 [郵件流程>規則]。
選 取 [+ 新增規則] ,然後選取 [ 建立新規則]。
在開啟的 [ 設定規則條件 ] 頁面中,設定下列設定:
名稱:輸入規則的唯一描述性名稱。
如果:使用正則表示式 (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
從外部帳戶,將測試訊息傳送給包含其中一個片語或文字模式的受影響收件者,並確認結果。