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.

Technical drawing of a wall cabinet with three plug-in modules wired to an inspection gate on a conveyor. A sealed envelope has passed the gate and moves toward an inbox tray.

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:

  1. SPF and DKIM on the sending domain.
  2. A DMARC record, at least p=none.
  3. The domain in the visible From address aligned with SPF or DKIM.
  4. One-click unsubscribe in marketing email.
  5. 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

RecordWhere it livesWhat it provesFails when
SPFTXT on the domain in the Return-PathThe sending server is allowed to send for that domainMail comes from a server not in the list
DKIMTXT at selector._domainkey.yourdomain.comThe message was signed by the domain and not changed in transitThe body or signed headers were altered, or the key does not match
DMARCTXT at _dmarc.yourdomain.comThe From domain matches a domain that passed SPF or DKIM, and states a policyNeither SPF nor DKIM passes in alignment with the From domain
Technical drawing of an envelope pulled apart into stacked layers, with detail circles showing each layer.
FIG. 01Each record is a separate layer. DMARC only passes when one of the other two passes for the same 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=none meets the requirement, but it does not stop anyone from sending as your domain. Plan the move to quarantine or reject from 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

  1. Pick a sending subdomain.
  2. Add one SPF record that includes every service sending for it.
  3. Add the DKIM record generated for the domain.
  4. Add DMARC at p=none with a report address.
  5. Verify in the app and with a test message.
  6. After a few weeks of clean reports, move DMARC to quarantine, then reject.

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.

Get new posts by email

Guides on sending at volume, deliverability and pricing. One email when a post goes up. Unsubscribe any time.

By subscribing you agree to receive these emails. See the Privacy Policy.

Keep reading

Recommended posts

DeliverabilitySeptember 29, 20267 min read

DMARC policy: move from p=none to p=reject safely

Move DMARC to enforcement safely: inventory every sender from rua reports, fix alignment, set subdomain policy, stage the change and keep a rollback ready.