What are SPF, DKIM and DMARC, and how does the check work?
The email protocol was built without any mechanism to verify who really sent a message, so anyone can write an address at your domain in the “From” field. Three DNS records close this gap, and the mail servers of Gmail, Outlook and other providers check them on every message they receive.
SPF is a TXT record at the root of the domain that starts with v=spf1 and lists which servers are allowed to send on its behalf: IP addresses and the include entries of email service providers. The record ends with the all mechanism, which decides what to do with everyone else: -all to block, ~all to mark as suspicious. Keep one record only and do not exceed the limit of 10 DNS lookups.
DKIM adds a cryptographic signature to every message. The public key is published in DNS under a name called a selector, and the receiving server uses it to verify that the message was sent from the domain and was not altered in transit. The accepted practice today is a 2048-bit RSA key.
DMARC is a TXT record at the domain's _dmarc address. It requires SPF or DKIM to pass in alignment with the domain shown in the “From” field, and decides what happens when that is not the case: p=none (monitoring only), p=quarantine (spam) or p=reject (rejection). It also lets you receive reports (rua) about everyone who sends mail on behalf of the domain.
The tool sends DNS-over-HTTPS queries to Cloudflare's public DNS server, reads the SPF, DMARC and MX records and checks for DKIM keys at the selector you entered or at the common selectors. Every record gets a status (OK, needs improvement or problem) with an explanation and a recommended fix, and an overall score is calculated from all of these: SPF and DKIM are worth 30 points each and DMARC is worth 40, because it is what turns authentication into actual protection. The score is an aid for quick orientation, not an official rating by the mail providers.
A recommended order of work for fixing things: first, map all the services that send mail on behalf of the domain: the mailboxes, the email marketing system, the CRM, the invoicing system and the website itself. Then make sure they all appear in a single SPF record or sign with DKIM using your domain. Next, publish DMARC with p=none and a rua address, and read the reports for a few weeks. Only when all legitimate mail passes authentication do you tighten to quarantine and then to reject. Remember that a DNS change takes effect according to the record's TTL value, so sometimes you need to wait a little before checking again.
