Protecting Microsoft 365 email from spam and phishing
An employee gets an invoice from a “supplier”, clicks the attachment and types their password into a page that looks like the Microsoft 365 sign-in. Some messages like this get through the filter, and some real email lands in spam. Both are expensive.
The short answer: Microsoft 365 has decent protection from day one, but it is set to medium caution. A stricter anti-spam and anti-phishing policy, plus three DNS records (SPF, DKIM and DMARC), close most of the gaps. Below I describe what they do and how to set them up.
What Microsoft 365 filters by default
Every mailbox in Exchange Online goes through Exchange Online Protection. It’s a set of filters that works without any configuration. It rejects messages from known malicious addresses, scans them for viruses and judges whether they are spam. Messages judged to be spam go to the Junk Email folder or to quarantine.
The default settings are lenient. Microsoft would rather let a doubtful message in than lose a real one. That’s why cleverly written phishing, which doesn’t look like mass spam, often reaches the mailbox.
Extra features, such as checking links at the moment of the click or opening attachments in a sandbox, depend on the licence. Before you count on them working, check what your plan includes.
What a stricter policy changes
You set the policies in the Microsoft Defender portal (security.microsoft.com), in the Email & collaboration section, then Policies & rules and Threat policies. There are two separate areas there: anti-spam and anti-phishing.
The anti-spam policy decides what to do with a message the filter judges to be spam, high confidence spam or phishing. The stricter setting is moving it to quarantine instead of the junk folder. A user won’t open by accident something they never saw.
The anti-phishing policy adds protection against impersonation. You can name the people fraudsters most often pretend to be, for example the owner or the person who handles accounting. A message that pretends to be one of them but comes from an outside address then goes to quarantine, if you set it that way. Naming protected people requires Defender for Office 365, which comes with Business Premium or as a paid add-on. Business Basic and Business Standard don’t have this option.
The price of caution is simple: more real messages will end up in quarantine. Someone has to review it, so it’s worth agreeing who.
SPF, DKIM and DMARC in plain words
All three are records in your domain’s DNS. They answer one question: did this message really come from the company whose address is shown as the sender?
SPF is a list of the servers allowed to send email on behalf of the domain. The recipient checks whether the message came from one of them. If you also send from an accounting system or a newsletter tool, they have to be on the list too.
DKIM is a digital signature on the message. The sending server adds a signature, and the recipient checks it with the public key from DNS. That way the message can’t have been changed along the way.
DMARC tells recipients what to do with a message that passes neither SPF nor DKIM: nothing, quarantine or reject. On top of that you get reports about who is sending email on behalf of your domain. It’s the last piece, because without it a fraudster can pretend to be your company to your customers.
Setting it up step by step
The examples below use the domain company.example. Replace it with your own.
- SPF. Add a TXT record for the main domain. If you already have one, extend it, because a domain can have only one SPF record.
company.example. TXT "v=spf1 include:spf.protection.outlook.com -all"
- DKIM. In the Defender portal go to Email authentication settings, choose the domain and switch on signing. The portal gives you two CNAME records to add in DNS. Below is an example; copy the exact values from the portal. Once the records have propagated, you turn the switch on.
selector1._domainkey.company.example. CNAME selector1-company-example._domainkey.yourtenant.onmicrosoft.com.
selector2._domainkey.company.example. CNAME selector2-company-example._domainkey.yourtenant.onmicrosoft.com.
- DMARC. Start in monitoring mode, with a mailbox the reports will come to. In place of REPORT-ADDRESS enter your own mailbox address, because without the
rua=part no reports will arrive. Once the reports show that all your legitimate email passes, tighten the policy toquarantine, and later toreject.
_dmarc.company.example. TXT "v=DMARC1; p=none; rua=mailto:REPORT-ADDRESS"
This is how I do it: I usually move to quarantine after a month of monitoring, and to reject only after about three months. The domain first has to build a reputation, and the reports have to show every system that sends email on your behalf.
-
Anti-spam. In Threat policies open Anti-spam policies and edit the default policy. For high confidence spam and for phishing, set quarantine. Switch on notifications for users about messages in quarantine.
-
Anti-phishing. Open Anti-phishing, switch on impersonation protection and add the people fraudsters most often pretend to be. This step requires Defender for Office 365 (it’s in Business Premium). Without it, skip naming people, because you won’t see the option.
-
Ready-made sets. Instead of setting everything by hand, you can switch on the Standard or Strict preset policies in the Preset security policies section. It’s the quicker route, but you have less control over individual settings. For a small business I recommend starting with the Standard set. Once you’ve checked that legitimate email arrives and nobody is hunting for messages in quarantine, you can move to Strict.
Your own mail server: the allow list
If the company also sends email from its own server, real messages from it may land in spam. You can then add its public address to the allow list in the connection filter. In the Defender portal: Anti-spam, Connection filter policy, edit the default policy, the IP allow list section. You enter the server’s address, for example 203.0.113.50, and save.
The change takes effect after 30 to 60 minutes. You don’t restart anything. To undo it, you remove the address from the same list.
Use this sparingly. An address on the allow list skips some of the filters, so if someone takes over that server, the protection won’t stop them. Check SPF first, because it’s often the real cause.
What breaks
After you tighten the policy, the first symptom is complaints that something is missing. An invoice from a regular supplier has landed in quarantine. Look there before you release the message, and check the headers.
A common SPF mistake is two records instead of one, or too many include entries. Then SPF ends in an error, and email from the domain is rated worse than before the change. DMARC set straight to reject blocks your own messages from systems you forgot about, for example the invoicing program.
Remember one separate thing too: the yellow note about an external sender is not part of the anti-spam policy. It’s a separate Exchange feature and is set up somewhere else. Switching it off doesn’t change the filtering.
When to do it yourself and when to ask for help
You can set up SPF yourself, switch on the Standard preset policies and check whether the domain has DKIM. It’s an hour’s work if you have access to DNS and to the admin portal.
Help comes in handy when several systems send email from the domain, when another company runs your DNS, or when you want to get to DMARC reject without losing real messages. Then most of the time goes not into the settings, but into finding out who sends from where.
If you’d like me to review the email in your company, see how I work with Microsoft 365. I can also start with a free audit: I’ll check one part of your IT and you’ll get a short written report.