SPF, DKIM and DMARC: set up a new sending domain
The three DNS records every sending domain needs, what each one proves, the order to add them in, and how to check them before your first campaign.
Mailbox providers decide whether to trust your email before anyone reads it. Three DNS records do most of that work: SPF says which servers may send for your domain, DKIM signs each message so changes can be detected, and DMARC tells receivers what to do when the first two fail. This guide adds all three to a new domain, in order, and checks them.
Why all three are required now
Since February 2024, Gmail and Yahoo require authentication from everyone who sends to their users. Senders of more than 5,000 messages a day to Gmail have stricter rules:
- SPF and DKIM on the sending domain.
- A DMARC record, at least
p=none. - The domain in the visible From address aligned with SPF or DKIM.
- One-click unsubscribe in marketing email.
- A spam complaint rate below 0.3%.
If you send newsletters or product updates at volume, you are in the second group. Without these records, mail goes to spam or is rejected.
What each record does
| Record | Where it lives | What it proves | Fails when |
|---|---|---|---|
| SPF | TXT on the domain in the Return-Path | The sending server is allowed to send for that domain | Mail comes from a server not in the list |
| DKIM | TXT at selector._domainkey.yourdomain.com | The message was signed by the domain and not changed in transit | The body or signed headers were altered, or the key does not match |
| DMARC | TXT at _dmarc.yourdomain.com | The From domain matches a domain that passed SPF or DKIM, and states a policy | Neither SPF nor DKIM passes in alignment with the From domain |
Step 1: choose the domain you send from
Send from a subdomain such as news.yourcompany.com or mail.yourcompany.com, not from the root domain your staff use for everyday email. A subdomain keeps marketing reputation apart from your team’s mail, and you can set a strict DMARC policy on it sooner.
Step 2: add SPF
SPF is a single TXT record that lists who may send. A domain may have only one SPF record. If one exists, add to it instead of creating a second.
; TXT record on news.yourcompany.com
news.yourcompany.com. 3600 IN TXT "v=spf1 include:<value from your sender domain page> ~all"
Keep these limits in mind:
- SPF allows at most 10 DNS lookups. Each
include:counts, and so do includes inside includes. ~all(soft fail) is the usual ending while DMARC does the enforcing.-all(hard fail) is stricter.- Remove services you no longer use. Old includes waste lookups.
Step 3: add DKIM
DKIM uses a key pair. The private key signs each message, and the public key sits in DNS so receivers can check the signature. In EmailMarketer.io, adding a sender domain generates the DKIM record for you. Copy it into your DNS as shown.
; TXT record. The selector is the part before ._domainkey
em1._domainkey.news.yourcompany.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOC..."
Some DNS providers limit a TXT string to 255 characters. A 2048-bit key is longer, so the provider splits it into several quoted strings. That is expected and still valid.
Step 4: add DMARC, starting with monitoring
DMARC ties SPF and DKIM to the address people see in the From line. Start with a policy that only reports, read the reports for a few weeks, then tighten it.
; Week 1: monitor only
_dmarc.news.yourcompany.com. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc@yourcompany.com"
; After reports show only your own services: quarantine, then reject
_dmarc.news.yourcompany.com. 3600 IN TXT "v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarc@yourcompany.com"
_dmarc.news.yourcompany.com. 3600 IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc@yourcompany.com"
The policy values mean:
p=none: deliver as usual and send reports. Meets the Gmail and Yahoo minimum.p=quarantine: put failing mail in spam.p=reject: refuse failing mail. The strongest protection against people spoofing your domain.
A DMARC record at
p=nonemeets the requirement, but it does not stop anyone from sending as your domain. Plan the move toquarantineorrejectfrom the start.
Reading the reports
The rua address receives daily XML reports from receivers. Each one lists the servers that sent mail as your domain and whether SPF and DKIM passed. Look for servers you do not recognise: they are either a service you forgot to authenticate or someone spoofing you.
Step 5: check the records
DNS changes can take up to the record’s TTL to appear. Check each record from the command line:
# SPF
dig +short TXT news.yourcompany.com
# DKIM (replace em1 with your selector)
dig +short TXT em1._domainkey.news.yourcompany.com
# DMARC
dig +short TXT _dmarc.news.yourcompany.com
Then use the verify button on the sender domain page in EmailMarketer.io. It checks each record and shows which one is missing or wrong. Finally, send a test email to a Gmail address, open it, choose Show original, and confirm that SPF, DKIM and DMARC all say PASS.
Checklist
- Pick a sending subdomain.
- Add one SPF record that includes every service sending for it.
- Add the DKIM record generated for the domain.
- Add DMARC at
p=nonewith a report address. - Verify in the app and with a test message.
- After a few weeks of clean reports, move DMARC to
quarantine, thenreject.
Every EmailMarketer.io account goes through this before its first send. If you are moving from another tool, our free migration includes setting up these records with you.