As with prior versions of Exchange (Exchange 2007 and 2010), Exchange 2013 includes a decent spam filter. The spam filter allows you to block spam based on heuristic data analysis. While Exchange’s SPAM filter is not as complete as some of the commercial SPAM filters, it is free. As is the case with all SPAM filters, no SPAM filter has the magic solution to the SPAM epidemic.

How to Install the Anti-Spam Agent in Exchange 2013, 2016 Server

To install the anti-spam agents on your server, open PowerShell and execute the following command:

ExchangeInstallPath\Scripts\Install-AntiSpamAgents.ps1


Notice that “program files” and “exchange server” are encapsulated within quotation marks since they contain spaces. Once the anti-spam agents have been installed, you will receive a completion message and a restart request. You do not need to restart the server, restarting the transport service will suffice.

Next, restart the transport service by executing the following command:

Restart-Service MSExchangeTransport

Once the transport service has restarted, we need to identify the SMTP server. Execute the following PowerShell command:

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

Configuring the Anti-Spam Agents

You may find this hard to believe but Exchange 2013 does not support RBL (Real Time Block Lists); at least not at the time of this writing. So to block spam messages, we will use the content filter. The content filter reads the messages and assigns it a number between 1 and 7. The lower you set the SCL rating, the more restrictive the spam filter will be.

Setting it to 7 is least restrictive but it will allow for more spam in your inbox. Setting it to 1 will allow less spam, but will indubitably block more legitimate mail. Finding the happy number that blocks spam while letting legitimate e-mail through is a challenging task. I recommend starting at 4. As users get blocked, add them to the white list and then gradually reduce the SCL rating down to 2.

First, to enable the the content filter, execute the following PowerShell command:

Set-ContentFilterConfig -Enabled $true

To set the SCL rating to reject messages regarded as spam, execute the following command:

Set-ContentFilterConfig -SCLRejectEnabled $true -SCLRejectThreshold <Value 1-7>

To configure a rejection response, execute the following command:

Set-ContentFilterConfig -RejectionResponse "Your Message Here”

Here is a list of commands to manage Exchange 2013 SPAM filter settings as well as commands to manage the Content Filter.

Leave a comment

Your email address will not be published. Required fields are marked *

error: Sorry, copy/paste is disabled
Skip to content