Menu

Search tools and guides

DMARC & DKIMCheck DMARC and DKIM, generate records and keys
SPF Record CheckerValidate SPF and count lookups against the limit of 10
DNS Blacklist CheckerCheck IPs and mail servers against spam blocklists
Email Header AnalyserTrace hops, delays and SPF/DKIM/DMARC in raw headers
Email ValidatorSyntax, MX, SPF and DMARC verification
DNS LookupQuery A, AAAA, MX, TXT, NS and more
WHOIS LookupRegistration data over RDAP
Website StatusAvailability and response-time checks
Ports ReferenceWhat runs on each TCP and UDP port, and if it's safe
MAC Address LookupFind a MAC address vendor and check if it's random
Download Time CalculatorHow long a file takes at your broadband speed
QR Code GeneratorQR codes for Wi-Fi, links and text, as PNG or SVG
User Agent ParserWhat your browser says about itself, decoded
IP ConverterDecimal, hex, binary and IPv6 conversion
Subnet CalculatorCIDR ranges, masks and subnet splitting
CIDR AggregatorMerge IPs and ranges into the fewest CIDR blocks
SSL CheckerInspect certificates, chains and expiry
HTTP HeadersAudit security headers and redirect chains
Password GeneratorCryptographically secure random passwords
Hash GeneratorMD5, SHA-1, SHA-256, SHA-384 and SHA-512
JWT DecoderDecode JWT claims and verify HS256, RS256, ES256
Unix Timestamp ConverterConvert epoch seconds or ms to UTC and UK time
UUID GeneratorGenerate UUID v4, v7 and ULIDs; decode any UUID
Cron Expression ExplainerCron schedules in plain English, with next runs
Regex TesterTest JavaScript regex with live match highlighting
Chmod CalculatorUnix permissions as octal, symbols and commands
Colour Contrast CheckerWCAG contrast ratio for text and background colours
JSON FormatterPretty-print, minify and validate JSON
Base64 EncoderConvert to and from Base64, Unicode safe
URL EncoderPercent-encode and decode URL strings
HTML EntitiesEscape and unescape HTML special characters
Text Diff CheckerCompare two texts line by line, word by word
Word & Character CounterWords, characters, reading time and SMS segments
Case ConverterUPPER, lower, Title Case, camelCase and more
URL Slug GeneratorTurn titles into clean, SEO-friendly URL slugs
DNS records explained: A, AAAA, CNAME, MX, TXT, NS and the restWhat each common DNS record type does, the rules that trip people up – CNAMEs at the root, MX pointing at an IP – and how TTL and caching really work.
Mbps and MB/s: why downloads look slower than your broadband speedWhy a 100 Mbps line downloads at 12 MB/s, why a 1 TB drive shows 931 GB, what slows real transfers, and what a UK advertised average speed promises.
Setting up SPF, DKIM and DMARC for Microsoft 365Step by step for a domain on Microsoft 365, from the first SPF record to a DMARC policy of reject, avoiding the mistakes that cause bounces.
SPF "too many DNS lookups": why it happens and how to fix itWhat the ten-lookup limit in RFC 7208 counts, how to tally your own record, and the fixes that work without silently breaking mail.
How to read a DMARC aggregate reportA field-by-field tour of the XML that receivers send to your rua= address, and how to turn it into a list of senders to fix before you enforce.
What your IP address reveals – and what it does notHow IP geolocation really works, why it often puts you in the wrong town, what a website can and cannot learn from your address, and how UK law treats it.
Diagnosing a website that will not load: DNS, TLS and HTTP in orderA methodical checklist for working out whether an outage is DNS, the certificate, the server or just you – and what each kind of failure looks like.

Arrow keys move through results, Enter opens one, Escape closes.

Setting up SPF, DKIM and DMARC for Microsoft 365

Step by step for a domain on Microsoft 365, from the first SPF record to a DMARC policy of reject, avoiding the mistakes that cause bounces.

By BD Digital Creations. Published , updated , 8 minute read.

In short

Setting up SPF, DKIM and DMARC for Microsoft 365 means publishing one SPF record that includes spf.protection.outlook.com, adding the two DKIM CNAME records shown in the Defender portal and switching on signing, then publishing DMARC at p=none. Once the reports show every legitimate sender passing, move the policy to quarantine and finally to reject.

On this page

If your business email runs on Microsoft 365, three DNS records decide whether your messages are trusted: SPF, DKIM and DMARC. Since February 2024 Google and Yahoo have required them from anyone sending in volume, and Microsoft brought in the same requirement for mail to Outlook.com and Hotmail addresses in May 2025. Even a small firm that sends a handful of invoices a day benefits: a domain without DMARC can be spoofed by anyone, and receivers are quicker to send unauthenticated mail to junk.

This guide takes a domain from nothing to a DMARC policy of p=reject. It assumes the domain is already added and verified in Microsoft 365 and that mail is flowing. Throughout, example.co.uk stands for your domain.

Before you start: make a list of everything that sends email as your domain, not just Outlook. Website contact forms, your accounting package, your CRM, a newsletter platform, a booking system, the office printer that emails scans. Every one of them has to pass SPF or DKIM in its own right before you enforce DMARC, or its mail will start to disappear.

How the three records fit together

#

SPF (Sender Policy Framework) is a list of the servers allowed to send mail for a domain. A receiver checks the address the message was sent from at the envelope level – the bounce or Return-Path address, which is often not the one you see in your mail client.

DKIM (DomainKeys Identified Mail) is a cryptographic signature added by the sending server. The receiver fetches a public key from your DNS and checks the signature, which proves the message was not altered and was signed by someone holding your private key.

DMARC ties them to the address people actually see. A message passes DMARC when SPF or DKIM passes and the domain that passed matches the visible From: domain. That matching is called alignment, and it is where most problems hide: a service can pass SPF for its own domain and still fail DMARC for yours.

Of the three, DKIM matters most. SPF breaks whenever a message is forwarded, because the forwarding server is not on your list. A DKIM signature travels with the message and usually survives.

Step 1: Publish one SPF record

#

Microsoft 365's outbound servers are covered by a single include. In your DNS host, add a TXT record at the root of the domain (often entered as @):

example.co.uk.  TXT  "v=spf1 include:spf.protection.outlook.com -all"

Three rules catch people out:

  • A domain may have only one SPF record. If one already exists – perhaps your web host added v=spf1 a mx ~all years ago – merge them into one rather than adding a second. Two SPF records make every SPF check return a permanent error.
  • Add other senders to the same record, using the include each provider documents, for example v=spf1 include:spf.protection.outlook.com include:mail.zendesk.com -all.
  • Stay within ten DNS lookups. Every include, a, mx and redirect costs at least one, and includes can contain further includes. Go over ten and SPF returns a permanent error. Our guide to the SPF lookup limit explains how to count and what to do if you are over.

-all tells receivers that anything not listed is unauthorised. ~all (a "soft fail") is a gentler alternative while you are still discovering senders. Once DMARC is enforcing, the difference matters little, because DMARC makes the final decision.

Step 2: Turn on DKIM signing for your domain

#

Out of the box, Microsoft 365 does not sign your mail with your own domain. The only automatic signing uses your tenant's onmicrosoft.com domain, and a signature from that domain does not align with example.co.uk, so for DMARC purposes it counts for nothing. You need to switch on signing for your own domain.

  1. Sign in to the Microsoft Defender portal and go to Email & collaboration → Policies & rules → Threat policies → Email authentication settings, then open the DKIM tab.
  2. Select your domain. If DKIM is not yet set up, choose Create DKIM keys and the details pane then shows two CNAME records to publish, named selector1._domainkey and selector2._domainkey.
  3. Create both CNAME records at your DNS host, copying the target values exactly as the portal shows them. For domains added before May 2025 they end in onmicrosoft.com; domains added since then get targets ending in dkim.mail.microsoft. Do not try to construct them yourself.
  4. Wait for the records to be visible – usually minutes, occasionally a few hours – then return to the portal and turn on Sign messages for this domain with DKIM signatures.

Using CNAMEs means Microsoft holds the private keys and can rotate them for you. The portal's Rotate DKIM keys button switches between selector1 and selector2, which is why both records must exist.

To confirm the records are live, enter your domain in our DMARC & DKIM Checker, which probes both Microsoft selectors automatically and reports the key length behind them.

A common snag: the DNS panel adds your domain twice

Many DNS control panels append your domain to whatever you type in the name field. Typing selector1._domainkey.example.co.uk then creates selector1._domainkey.example.co.uk.example.co.uk, and the portal will never find it. Enter just selector1._domainkey and check the result with a DNS lookup for the CNAME.

Step 3: Publish DMARC in monitoring mode

#

Start with a policy that changes nothing for delivery but asks receivers to send you daily reports. Add a TXT record named _dmarc:

_dmarc.example.co.uk.  TXT  "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.co.uk"

The rua address receives aggregate reports: XML files, one per receiver per day, listing every IP address that sent mail claiming to be you and whether it passed. They arrive in volume, so use a dedicated mailbox or a free report-processing service rather than your own inbox. If the address is on a different domain from the one being reported on, that domain must publish an authorisation record; hosted DMARC services do this for you.

Our DMARC generator builds this record, and will load your live record later so you can see exactly what changes when you tighten the policy.

Step 4: Read the reports and fix every legitimate sender

#

Give it two to four weeks so that monthly jobs – payroll, statements, renewal reminders – have a chance to appear. Then work through the senders in the reports. Each falls into one of four groups:

What you seeWhat it meansWhat to do
Microsoft IPs, DKIM pass, alignedYour Outlook mail, working correctlyNothing
A service you use, SPF or DKIM pass but not alignedIt authenticates as its own domain, not yoursSet up the provider's "domain authentication" (usually DKIM CNAMEs) for your domain
A service you use, failing bothNot configured at allAdd its SPF include and its DKIM records, or move it to a subdomain
IP addresses you do not recognise, failing bothUsually spoofing – exactly what DMARC exists to stopNothing; enforcement will deal with it

The second row is the one that bites. Newsletter and CRM platforms commonly send with their own bounce domain, so SPF passes – for them. Adding their include to your SPF record does not help, because SPF is checked against their domain, not yours. What makes them align is DKIM signing with your domain, which every reputable platform supports under a name such as "authenticate your domain" or "custom sending domain".

Our guide to reading DMARC aggregate reports walks through the XML field by field.

Step 5: Move to quarantine, then reject

#

When the reports show only your known senders passing, and the failures are all strangers, tighten the policy. A cautious path is to publish quarantine in testing mode first:

v=DMARC1; p=quarantine; t=y; rua=mailto:dmarc-reports@example.co.uk

The t=y flag asks receivers to apply one step less than the stated policy, so failing mail is still delivered while the reports show what quarantine would catch. It was introduced by RFC 9989, the 2026 replacement for the original DMARC specification (RFC 7489), which also removed the older pct percentage tag; a receiver that has not adopted the new specification ignores t=y and quarantines failing mail straight away. Keep an eye on the reports and on any complaints of missing mail, then remove t=y, leave quarantine in place for at least a month, and finally move to reject:

v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.co.uk

At p=reject, you ask receivers to refuse mail that fails DMARC outright; the final decision is theirs, and Gmail and Microsoft 365 both reject such mail. Spoofed invoices and fake "change of bank details" messages sent in your name stop reaching anyone who checks DMARC – which today means nearly every major mailbox provider.

One caution before the last step. RFC 9989 says that domains whose users post to mailing lists should not publish p=reject: a list usually alters a message in ways that break its DKIM signature, and subscribers' mail servers then refuse it, which can get those subscribers removed from the list. If your staff take part in external mailing lists, stopping at p=quarantine is a reasonable final policy.

If you never send mail from subdomains, it is also worth adding sp=reject so that made-up subdomains such as billing.example.co.uk cannot be abused either.

Checking that it works

#

Send a message from Outlook to a Gmail address, open it, and choose Show original. Gmail summarises the result at the top: you want PASS for SPF, DKIM and DMARC, and the DKIM line should mention example.co.uk, not your onmicrosoft.com domain. In Outlook, the same information is in the message headers under Authentication-Results.

For an at-a-glance view of all three records, run your domain through the DMARC & DKIM Checker. It grades the setup, explains each tag in plain English, and flags the common mistakes covered here.

Quick reference

#
RecordTypeNameValue
SPFTXT@v=spf1 include:spf.protection.outlook.com -all (plus your other senders)
DKIMCNAMEselector1._domainkeyCopied exactly from the Defender portal
DKIMCNAMEselector2._domainkeyCopied exactly from the Defender portal
DMARCTXT_dmarcStart at v=DMARC1; p=none; rua=mailto:…, finish at p=reject

Spotted a mistake, or something out of date? Email hello@bddc.co.uk and we will correct it. How we research and maintain these guides is set out in our editorial policy.

Accessibility

Adjust how the site looks and behaves. Your choices are saved in this browser only.

Colour theme
Text size
Accessibility statement