SolidCP Windows 2016 support
09 - 11 - 2016v1.2.0 stable has been released!
01 - 04 - 2017Move spam marked by Mailcleaner to Junk folder in Exchange
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.
Automated Powershell Script
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
ECP version
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
- Login to the Exchange ECP
- go to MailFlow -> Rules
- Click on the + and select Create a new rule
- In the New Rule window select More Options... at the bottom (This will allow the header checks to be visible)
- Enter a name such as: Move Spam to Junk folder
- In Apply this rule if.. select A message header... and then matches these text patterns
- Click Enter text... and enter X-MailCleaner-SpamCheck and click Ok
- Click Enter text patterns... and enter spam and click Ok
- select the Dropdown under Do the following... and select Modify the message properties... then Set the spam confidence level (SCL) to...
- You will then set to set this 1 above your SCLJunkThreshold we checked above. So in our example we would set this to 5
- Under Except If select Add Exception drop the Dropdown above the add exception button select A message header... and then matches these text patterns
- Click Enter text... and enter X-MailCleaner-SpamCheck and click Ok
- Click Enter text patterns... and enter not spam and click Ok
- Set the Priority to 0 so it is the first rule
- Click Save
We would like to thank bluechip Computer AG who provided us with this guide.