Ensure that spam is routed to each user's Junk Email folder

Exchange Online
 

Applies to: Exchange Online Protection

Topic Last Modified: 2016-07-15

ImportantImportant:
This topic only applies to Exchange Online Protection (EOP) customers who host mailboxes on-premises in a hybrid deployment. Exchange Online customers whose mailboxes are fully-hosted in Office 365 do not need to run these commands.

The default anti-spam action for EOP customers is to move spam messages to the recipients’ Junk Email folder. In order for this action to work with on-premises mailboxes, you must configure Exchange Transport rules on your on-premises Edge or Hub servers to detect spam headers added by EOP. These Transport rules set the spam confidence level (SCL) used by the SclJunkThreshold property of the Set-OrganizationConfig cmdlet to move spam into the Junk Email folder of each mailbox.

To add transport rules to ensure spam is moved to the Junk Email folder by using Windows PowerShell
  1. Access the Exchange Management Shell for your on-premises Exchange server. To learn how to open the Exchange Management Shell in your on-premises Exchange organization, see Open the Shell.

  2. Run the following command to route content-filtered spam messages to the Junk Email folder:

    New-TransportRule "NameForRule" -HeaderContainsMessageHeader "X-Forefront-Antispam-Report" -HeaderContainsWords "SFV:SPM" -SetSCL 6
    

    Where NameForRule is the name for the new rule, for example, JunkContentFilteredMail.

  3. Run the following command to route messages marked as spam prior to reaching the content filter to the Junk Email folder:

    New-TransportRule "NameForRule" -HeaderContainsMessageHeader "X-Forefront-Antispam-Report" -HeaderContainsWords "SFV:SKS" -SetSCL 6
    

    Where NameForRule is the name for the new rule, for example, JunkMailBeforeReachingContentFilter.

  4. Run the following command to ensure that messages from senders in a block list in the spam filter policy, such as the Sender block list, are routed to the Junk Email folder:

    New-TransportRule "NameForRule" -HeaderContainsMessageHeader "X-Forefront-Antispam-Report" -HeaderContainsWords "SFV:SKB" -SetSCL 6
    

    Where NameForRule is the name for the new rule, for example, JunkMailInSenderBlockList.

If you do not want to use the Move message to Junk Email folder action, you can choose another action in your content filter policies in the Exchange admin center. For more information, see Configure your spam filter policies. For more information about these fields in the message header, see Anti-spam message headers.

 
Show: