Applies to: Exchange Server 2013

Topic Last Modified: 2012-10-03

Sender filtering is provided by the Sender Filter agent. The Sender Filter agent relies on the MAIL FROM: SMTP header to determine what action, if any, to take on an inbound email message.

When sender filtering functionality is enabled on an Exchange server, sender filtering functionality filters all messages that come through all Receive connectors on that computer.

What do you need to know before you begin?

  • Estimated time to complete each procedure: 5 minutes

  • You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Anti-spam features" entry in the Anti-Spam and Anti-Malware Permissions topic.

  • You can't use the Exchange admin center (EAC) to perform this procedure. You can only use the Shell.

  • By default, anti-spam features aren't enabled in the Transport service on a Mailbox server. Typically, you only enable the anti-spam features on a Mailbox server if your Exchange organization doesn't do any prior anti-spam filtering before accepting incoming messages. For more information, see Enable Anti-Spam Functionality on a Mailbox Server.

  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard Shortcuts in the Exchange Admin Center.

Tip:
Having problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection

What do you want to do?

Use the Shell to enable or disable sender filtering

To disable sender filtering, run the following command:

Copy Code
Set-SenderFilterConfig -Enabled $false

To enable sender filtering, run the following command:

Copy Code
Set-SenderFilterConfig -Enabled $true
Note:
When you disable sender filtering, the underlying Sender Filter agent is still enabled. To disable the Sender Filter agent, run the command: Disable-TransportAgent "Sender Filter Agent".

How do you know this worked?

To verify that you have successfully enabled or disabled sender filtering, do the following:

  1. Run the following command:

    Copy Code
    Get-SenderFilterConfig | Format-List Enabled
    
  2. Verify the value displayed is the value you configured.

Use the Shell to configure blocked senders and domains

To replace the existing values, run the following command:

Copy Code
Set-SenderFilterConfig -BlockedSenders <sender1,sender2...> -BlockedDomains <domain1,domain2...> -BlockedDomainsAndSubdomains <domain1,domain2...>

This example configures the Sender Filter agent to block messages from kim@contoso.com and john@contoso.com, messages from the fabrikam.com domain, and messages from northwindtraders.com and all its subdomains.

Copy Code
Set-SenderFilterConfig -BlockedSenders kim@contoso.com,john@contoso.com -BlockedDomains fabrikam.com -BlockedDomainsAndSubdomains northwindtraders.com

To add or remove entries without modifying any existing values, run the following command:

Copy Code
Set-SenderFilterConfig -BlockedSenders @{Add="<sender1>","<sender2>"...; Remove="<sender1>","<sender2>"...} -BlockedDomains @{Add="<domain1>","<domain2>"...; Remove="<domain1>","<domain2>"...} -BlockedDomainsAndSubdomains @{Add="<domain1>","<domain2>"...; Remove="<domain1>","<domain2>"...}

This example configures the Sender Filter agent with the following information:

  • Add chris@contoso.com and michelle@contoso.com to the list of existing senders who are blocked.

  • Remove tailspintoys.com from the list of existing sender domains that are blocked.

  • Add blueyonderairlines.com to the list of existing sender domains and subdomains that are blocked.

Copy Code
Set-SenderFilterConfig -BlockedSenders @{Add="chris@contoso.com","michelle@contoso.com"} -BlockedDomains @{Remove="tailspintoys.com"} -BlockedDomainsAndSubdomains @{Add="blueyonderairlines.com"}

How do you know this worked?

To verify that you have successfully configured blocked senders, do the following:

  1. Run the following command:

    Copy Code
    Get-SenderFilterConfig | Format-List BlockedSenders,BlockedDomains,BlockedDomainsAndSubdomains
    
  2. Verify the values displayed are the values you configured.

Use the Shell to enable or disable blocking messages with blank senders

To enable or disable blocking message with blank senders, run the following command:

Copy Code
Set-SenderFilterConfig -BlankSenderBlockingenabled <$true | $false>

This example configures the Sender Filter agent to block messages that don't specify a sender in the MAIL FROM: SMTP command:

Copy Code
Set-SenderFilterConfig -BlankSenderBlockingEnabled $true

How do you know this worked?

To verify that you have successfully enabled or disabled blocking messages with blank senders, do the following:

  1. Run the following command:

    Copy Code
    Get-SenderFilterConfig | Format-List BlankSenderBlockingEnabled
    
  2. Verify the value displayed is the value you configured.