In this tutorial we will show you how to make Exchange automatically send Spam from MailCleaner directly to the users Junk folder in their Mailbox.
This rule is based on the MailCleaner header and not the subject to prevent any emails with spam in the subject being sent to the Junk Mail.
The below PowerShell script will create the rule for you with the correct value. It will need to be ran in the Exchange Management Shell.
$SCLJunkThreshold = (Get-OrganizationConfig).SCLJunkThreshold $SCLJunkThreshold++ New-TransportRule -Name "Move Spam to Junk folder" -HeaderMatchesMessageHeader "X-MailCleaner-SpamCheck" -HeaderMatchesPatterns "spam" -SetSCL $SCLJunkThreshold -ExceptIfHeaderMatchesMessageHeader "X-MailCleaner-SpamCheck" -ExceptIfHeaderMatchesPatterns "not spam" -Priority 0
First we need to check for the SCL Junk Threshold. This will tell us at what the highest number SCL will find a email as good. We will set this just above the threshold.
Run this Command: Get-OrganizationConfig | fl *SCL*
Create the transport rule