Without SPF, DKIM, and DMARC, anyone on the internet can send email that appears to come from your domain. Attackers exploit this to run phishing campaigns that impersonate your brand. All three records work together — individually they're partial, together they're powerful.
The Simple Mail Transfer Protocol (SMTP) was designed in 1982 and has essentially no built-in authentication. Any mail server can claim to be sending on behalf of any domain. The "From" address a user sees in their email client is completely untrusted unless the receiving server has a way to verify it.
Email spoofing is used in phishing attacks ("Your bank account has been locked — click here"), business email compromise ("Please wire $50,000 to this account — CEO"), and spam campaigns that damage your domain's reputation. Even if you never send marketing email, attackers can send phishing mail from your domain to your customers' inboxes.
SPF, DKIM, and DMARC are DNS-based standards that let receiving mail servers verify whether a message claiming to come from your domain actually did. Without them, there's nothing to verify.
SPF is a DNS TXT record that lists all the IP addresses and hostnames that are authorised to send email on behalf of your domain. When a receiving mail server gets a message claiming to be from @yourdomain.com, it looks up your SPF record and checks whether the sending server's IP is on the list. If it's not, the receiving server knows the email is suspicious.
v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.5 ~all
v=spf1 — identifies this as an SPF recordinclude: — imports another domain's SPF record (your email provider's)ip4: — explicitly authorises an IPv4 address or range~all — soft fail: mark unauthorised sources as suspicious but still deliver them-all — hard fail: reject unauthorised sources entirely (use this once you're confident)+all — allow all (never use this — it negates SPF entirely)include: and a: mechanism counts against this limit. Chains of includes can push you over. Use an SPF flattening tool to consolidate IPs if needed.
Add a TXT record to your domain's DNS for the root domain (@ or yourdomain.com). Only one SPF record per domain is allowed — if you have multiple, merge them into one.
DKIM adds a cryptographic signature to every outgoing email. Your mail server signs each message with a private key. The receiving server looks up your public key in DNS and verifies the signature. If the signature matches, the email hasn't been tampered with and genuinely came from a server that holds your private key.
Unlike SPF (which checks the sending server's IP), DKIM survives email forwarding — the signature travels with the message and remains verifiable even after the email has been relayed through other servers.
DKIM records are published as TXT records at a specific "selector" subdomain. Your email provider will tell you which selector to use (commonly google, s1, k1, or a custom value). The record name looks like:
selector._domainkey.yourdomain.com
The value contains the public key in a specific format provided by your email service. You don't generate this manually — your email provider (Google Workspace, Microsoft 365, SendGrid, Mailgun etc.) gives you the exact record to add.
You can have multiple DKIM selectors — one per email sending service. If you send via Google Workspace and SendGrid, you'll have two separate DKIM records, each with a different selector name. This is normal and intentional.
DMARC ties SPF and DKIM together and tells receiving servers what to do when a message fails both checks. It also enables reporting — you receive daily XML reports from major mail providers showing who is sending email from your domain.
DMARC alignment requires that the "From" domain in the email header matches the domain that passed SPF or DKIM. This closes a bypass where an attacker could pass SPF using their own domain but display your domain in the visible From header.
v=DMARC1; p=reject; rua=mailto:dmarc-reports@yourdomain.com; pct=100
| Policy | Action | When to use |
|---|---|---|
p=none | Take no action — monitor only. Emails still get delivered. | Starting out. Collect reports, fix SPF/DKIM issues before enforcing. |
p=quarantine | Mark failing emails as spam. | Intermediate stage after fixing obvious issues. |
p=reject | Reject failing emails at the server level. They never reach the inbox. | Final goal once you're confident all legitimate mail passes SPF or DKIM. |
~all (soft fail) initially.dig TXT yourdomain.com — check your SPF record from the command line.dig TXT _dmarc.yourdomain.com — check your DMARC record.v=spf1 -all and v=DMARC1; p=reject to any domain that doesn't send email.
WebAudit scans your SPF, DMARC, and DKIM records and flags weak policies or missing records with specific fix recommendations.
Check your site's security now →