共用方式為


在信箱伺服器上啟用反垃圾郵件功能

Exchange 2016 和 Exchange 2019 信箱伺服器上的傳輸服務提供下列反垃圾郵件代理程式,但預設不會安裝這些代理程式:

  • 內容篩選器代理程式

  • 寄件者篩選器代理程式

  • 寄件者識別碼代理程式

  • 寄件者信譽的通訊協定分析代理程式

您也可以使用 Exchange 管理命令介面 指令碼在信箱伺服器上安裝這些反垃圾郵件代理程式,如果這些代理程式是您唯一的防禦措施,請務必要加以安裝以協助防止垃圾郵件。 一般而言,如果組織對內送郵件使用其他類型的反垃圾郵件篩選,您就不需要在信箱伺服器上安裝反垃圾郵件代理程式。

注意事項

雖然您可以在 Mailbox Server 上使用收件者篩選代理程式,但是不應該進行設定。 Mailbox Server 上的收件者篩選在含有其他有效收件者的郵件中偵測到一個無效或已封鎖收件者時,即會拒絕郵件。 如果您在信箱伺服器上安裝反垃圾郵件代理程式,則系統會啟用收件者篩選代理程式,但不會將它設定為封鎖任何收件者。

開始之前有哪些須知?

  • 完成此工作的預估時間:15 分鐘

  • 您只能使用 PowerShell 來執行此程序。 若要了解如何在內部部署 Exchange 組織中開啟 Exchange 管理命令介面,請參閱 Open the Exchange Management Shell

  • 無法使用信箱伺服器上的連線篩選代理程式與附件篩選器代理程式。 它們只能在 Edge Transport Server 上使用,而且預設會在該處安裝並啟用。 不過,信箱伺服器已安裝惡意軟體代理程式且預設為啟用。 如需詳細資訊,請參閱Exchange Server 中的反惡意程式碼防護

  • 如果您有其他 Exchange 反垃圾郵件代理程式會先處理郵件再將它們送達信箱伺服器 (例如,周邊網路中的 Edge Transport Server),則信箱伺服器上的反垃圾郵件代理程式會辨識郵件中已存在的反垃圾郵件 X-header 值,且這些郵件可直接通過而不會再次受到掃描。

  • 郵件流程權限 主題中的 您必須已獲指派權限,才能執行此程序或這些程序。 若要查看您需要的權限,請參閱「傳輸設定」項目。

  • 如需適用於此主題中程序的快速鍵相關資訊,請參閱 Exchange 系統管理中心的鍵盤快速鍵

提示

有問題嗎? 在 Exchange 論壇中尋求協助。 此論壇的網址為:Exchange ServerExchange OnlineExchange Online Protection

步驟 1:執行 Install-AntispamAgents.ps1 PowerShell 指令碼

在信箱伺服器上的 Exchange 管理命令介面中執行下列命令:

& $env:ExchangeInstallPath\Scripts\Install-AntiSpamAgents.ps1

如何才能了解此步驟是否正常運作?

若指令碼執行時未發生錯誤且要求重新啟動 Microsoft Exchange Transport 服務,代表此步驟正常運作。 其輸出看起來如下所示:

WARNING: Please exit Windows PowerShell to complete the installation.
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
Identity                                           Enabled         Priority
--------                                           -------         --------
Content Filter Agent                               True            8
WARNING: Please exit Windows PowerShell to complete the installation.
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
Sender Id Agent                                    True            9
WARNING: Please exit Windows PowerShell to complete the installation.
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
Sender Filter Agent                                True            10
WARNING: Please exit Windows PowerShell to complete the installation.
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
Recipient Filter Agent                             True            11
WARNING: Please exit Windows PowerShell to complete the installation.
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
WARNING: The following service restart is required for the change(s) to take effect : MSExchangeTransport
Protocol Analysis Agent                            True            12
WARNING: The agents listed above have been installed. Please restart the Microsoft Exchange Transport service for
changes to take effect.

步驟 2:重新啟動 Microsoft Exchange Transport 服務

在信箱伺服器上的 Exchange 管理命令介面中執行下列命令:

Restart-Service MSExchangeTransport

如何才能了解此步驟是否正常運作?

若 Microsoft Exchange Transport 服務重新開啟時未發生錯誤,代表此步驟正常運作。 輸出看起來像這樣:

WARNING: Waiting for service 'Microsoft Exchange Transport (MSExchangeTransport)' to start...
WARNING: Waiting for service 'Microsoft Exchange Transport (MSExchangeTransport)' to start...
WARNING: Waiting for service 'Microsoft Exchange Transport (MSExchangeTransport)' to start...
WARNING: Waiting for service 'Microsoft Exchange Transport (MSExchangeTransport)' to start...
WARNING: Waiting for service 'Microsoft Exchange Transport (MSExchangeTransport)' to start...
WARNING: Waiting for service 'Microsoft Exchange Transport (MSExchangeTransport)' to start...

步驟 3:指定組織的內部 SMTP 伺服器

您必須指定每個內部 SMTP 伺服器的 IP 位址,讓寄件者 ID 代理程式忽略。 事實上,您需要至少指定一個內部 SMTP 伺服器的 IP 位址。 如果執行反垃圾郵件代理程式的信箱伺服器是組織中唯一的 SMTP 伺服器,請指定該電腦的 IP 位址。

若要在不影響任何現有值的情況下新增內部 SMTP 伺服器的位址,請在信箱伺服器上的 Exchange 管理命令介面中執行下列命令:

Set-TransportConfig -InternalSMTPServers @{Add="<ip address1>","<ip address2>"...}

此範例會將內部 SMTP 伺服器位址 10.0.1.10 和 10.0.1.11 新增至組織的傳輸組態。

Set-TransportConfig -InternalSMTPServers @{Add="10.0.1.10","10.0.1.11"}

如何才能了解此步驟是否正常運作?

若要確認是否已成功地指定至少一個內部 SMTP 伺服器的 IP 位址,請在信箱伺服器上的 Exchange 管理命令介面中執行下列命令,並確認是否有顯示至少一個有效的內部 SMTP 伺服器的 IP 位址。

Get-TransportConfig | Format-List InternalSMTPServers

步驟 4:後續步驟

  • 信箱伺服器上現在應該已安裝並執行內容篩選代理程式、寄件者識別碼代理程式、寄件者篩選代理程式和通訊協定分析 (寄件者信譽) 代理程式。 若要進行確認,請在信箱伺服器上的 Exchange 管理命令介面中執行下列命令:

    Get-TransportAgent
    
    Get-ContentFilterConfig | Format-Table Name,Enabled; Get-SenderFilterConfig | Format-Table Name,Enabled; Get-SenderIDConfig | Format-Table Name,Enabled; Get-SenderReputationConfig | Format-Table Name,Enabled
    
  • 若要查看每個代理程式設定的詳細資訊,請執行下列命令:

    Get-ContentFilterConfig | Format-List *Enabled,RejectionResponse,*Postmark*,Bypassed*,Quarantine*;
    
    Get-SenderFilterConfig | Format-List *Enabled,*Block*
    
    Get-SenderIDConfig | Format-List *Enabled*,*Action,Bypassed*
    
    Get-SenderReputationConfig | Format-List *Enabled*,*Proxy*,*Block*,*Ports*
    
  • 若要設定每個代理程式,請參閱下列主題:

  • 根據預設,內容篩選代理程式、寄件者篩選代理程式和寄件者識別碼代理程式會將其活動記錄在信箱伺服器上的反垃圾郵件代理程式記錄中。 如果有資訊寫入記錄中,您就可以確認這些反垃圾郵件代理程式正在運作。 若要查看記錄的位置和設定,請在信箱伺服器上的 Exchange 管理命令介面中執行下列命令:

    Get-TransportService | Format-List AgentLog*
    

如需如何設定記錄的指示,請參閱<Configure antispam Agent Logging>。