Many organizations want to ensure that emails identified as spam and graymail never reach the user's Inbox or Junk folder, but are instead held in the Microsoft 365 Quarantine. Defend injects specific headers into the metadata of an email after analysis. The following headers are added to spam and graymail email headers:
- X-Egress-Defend-Spam
- X-Egress-Defend-Graymail
You can trigger actions based on these two header values. Therefore, mail flow rules can be used to trigger emails containing these header values being sent to the Microsoft 365 Quarantine.
Send Spam to Quarantine
To ensure spam bypasses the user entirely and is sent to quarantine, the following mail flow rule can be configured. This mail flow rule assumes you have your anti-spam policy set so that emails with a spam confidence level (SCL) of nine go to quarantine. This setting is the default for Microsoft 365.
To create the mail flow rule, follow the steps below:
- Log in to the Exchange Admin Center (EAC).
- Navigate to Mail flow > Rules.
- Click + Add a rule > Create a new rule.
- On the Set rule conditions page, enter a name for the rule in the Name field.
- Under Apply this rule if…, select to apply to The message headers > Includes any of these words:
- Header: X-Egress-Defend-Spam
- Value: true
- Under Do the following, select Modify the message properties > set the spam confidence level (SCL).
- Use the drop-down menu to specify the SCL as 9.
- Click Save.
- Click Next.
- Configure the rule settings as required.
- Click Next.
- Click Finish.
Send Graymail to Quarantine
To ensure graymail bypasses the user entirely and is sent to quarantine, the following mail flow rule can be configured. This mail flow rule assumes you have your anti-spam policy set so that emails with a spam confidence level (SCL) of five go to quarantine. This setting is the default for Microsoft 365.
To create the mail flow rule, follow the steps below:
- Log in to the Exchange Admin Center (EAC).
- Navigate to Mail flow > Rules.
- Click + Add a rule > Create a new rule.
- On the Set rule conditions page, enter a name for the rule in the Name field.
- Under Apply this rule if…, select to apply to The message headers > Includes any of these words:
- Header: X-Egress-Defend-Graymail
- Value: true
- Under Do the following, select Modify the message properties > set the spam confidence level (SCL).
- Use the drop-down menu to specify the SCL as 5.
- Click Save.
- Click Next.
- Configure the rule settings as required.
- Click Next.
- Click Finish.