Skip to main content

SPF, DKIM and DMARC

Set Up SPF, DKIM and DMARC for Google Workspace

By Tom Sather•Published •8 min read

Publish Google's SPF include, generate and turn on a DKIM key in the Admin console, then add a DMARC record at p=none and work up to enforcement.

On this page

To authenticate Google Workspace mail, you publish three DNS records: an SPF record that includes _spf.google.com, a DKIM key that you generate in the Admin console and then switch on, and a DMARC record at _dmarc.example.com. Do them in that order, start DMARC at p=none, and move to enforcement once your reports show every legitimate sender passing.

The whole job takes about fifteen minutes of clicking and up to a couple of days of waiting for DNS and Google's systems to catch up. Most of the problems come from the waiting, when people assume something failed and start changing records.

Before you start

You need two things:

  • Super administrator access to the Google Admin console (Google's DKIM page also mentions the Gmail Settings privilege).
  • Access to your DNS host, wherever your domain's records live. That's often your registrar, sometimes Cloudflare or a hosting company. Google doesn't host your DNS unless you bought the domain through Google.

Also make a list of everything else that sends mail as your domain: your newsletter platform, CRM, helpdesk, billing system. Workspace authentication only covers mail that Workspace itself sends. The rest needs its own setup, and DMARC will judge all of it. The sender inventory guide walks through building that list.

Step 1: SPF

SPF is a DNS record listing the servers allowed to send mail for your domain. (The full background is in What Is an SPF Record?.) For a domain that only sends through Workspace, Google's recommended record is:

v=spf1 include:_spf.google.com ~all
  1. At your DNS host, look for an existing TXT record on the root of the domain (often shown as @) that starts with v=spf1.
  2. If there isn't one, create a TXT record on @ with the value above.
  3. If there is one, edit it rather than adding a second record. Add include:_spf.google.com before the all at the end. For example, if you also send through a marketing platform:
v=spf1 include:_spf.google.com include:spf.esp.example.net ~all

Two SPF records on the same name break SPF for everything, which is one of the most common mistakes in this setup. See Multiple SPF Records if you find you already have two.

Google recommends ~all (softfail) and says SPF can take up to 48 hours to start working. Each subdomain that sends mail needs its own SPF record; the root record doesn't cover news.example.com.

Keep an eye on the lookup count as you add services. SPF allows at most 10 DNS lookups, and every include counts, along with any includes nested inside the records you include. The SPF analyzer will count them for you, and the lookup limit page covers what to do if you're over.

Step 2: DKIM

DKIM signs each message so receivers can verify it came from your domain. This is the step people skip, and it's the one that matters most for DMARC, because a DKIM signature from your own domain survives forwarding in a way SPF doesn't. Background is in What Is DKIM?.

  1. In the Admin console, go to Menu > Apps > Google Workspace > Gmail, then click Authenticate email.
  2. Pick your domain from the Selected domain menu.
  3. Click Generate New Record.
  4. Choose a 2048-bit key if your DNS host supports it. Only fall back to 1024-bit if it doesn't.
  5. Leave the prefix selector as google unless your domain already uses that selector for something else.
  6. Click Generate and copy the two values: the host name (google._domainkey) and the TXT value starting with v=DKIM1.
  7. Don't click Start authentication yet. Go to your DNS host and add a TXT record with that host name and value.
  8. Wait for the record to publish, then come back to Authenticate email, select the domain, and click Start authentication. The status should change to "Authenticating email with DKIM."

A 2048-bit key is a long string. Some DNS hosts handle it fine; others want it split into multiple quoted strings, and a few silently truncate it. If DKIM fails right after setup, check the published record against what Google gave you, character for character. The email checker shows what's actually in DNS.

Google's notes on timing: on a brand-new tenant, the DKIM key can take 24 to 72 hours to appear in the Admin console after Gmail is turned on, and after you add the DNS record, allow up to 48 hours for signing to work. The Authenticate email page may keep showing a DNS warning during that window even when the record is correct.

✨

If clicking Start authentication gives an error, the most common reason is that the DNS record hasn't propagated yet or was pasted with a missing character. Fix the record and try again later. Don't generate a new key each time; that just gives you a new value to publish.

Step 3: DMARC

DMARC tells receivers what to do when a message fails both SPF and DKIM for your domain, and sends you reports on who is sending as you. Google says to wait 48 hours after setting up SPF and DKIM before adding it. Nothing changes in the Admin console for this step; it's DNS only.

  1. Create a mailbox or Google Group to receive the reports. Google advises against using your personal address, because report volume can be high.
  2. At your DNS host, create a TXT record with the host _dmarc (which becomes _dmarc.example.com; some hosts add the domain for you, so don't type it twice).
  3. Start with a monitoring policy:
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com

The DMARC generator builds this for you, and DMARC Record Syntax explains every tag.

  1. Read the aggregate reports for a few weeks. You're looking for legitimate sources that fail: the CRM nobody set up DKIM for, the billing system sending through its own servers. Fix each one. How to read DMARC reports covers this.
  2. Move to p=quarantine, then p=reject. Google suggests using pct to apply the policy to a share of mail first and raising it to 100. RFC 9989, the current DMARC standard, retired pct in favor of a t=y test step. Receivers that implemented pct may keep honoring it for a while, but use t=y when you next edit the record. DMARC Policy covers the rollout in more detail.

If you're a bulk sender (Google's threshold is close to 5,000 or more messages a day to personal Gmail accounts), DMARC isn't optional: Gmail requires SPF, DKIM and DMARC. p=none satisfies the requirement, but enforcement is where DMARC actually protects you.

How to confirm it's working

Send a message from a Workspace account to an address at a different Gmail or Workspace account (Google notes you can't test by mailing yourself). Open it, choose Show original, and look for:

SPF:   PASS with IP 203.0.113.7
DKIM:  'PASS' with domain example.com
DMARC: 'PASS'

The DKIM line should name your domain. If it shows a Google domain instead, or there's no DKIM line, signing isn't on yet. The header analyzer will break down the full Authentication-Results header if you paste it in.

Keeping it working

  • Every new tool gets checked before it goes live. Most broken Workspace setups weren't broken on day one. Someone added a service later.
  • Watch DMARC reports after any change to DNS or sending platforms.
  • Rotate your DKIM key occasionally. In Workspace, you generate a new key, publish it under a new selector, and switch to it.
  • If mail still goes to spam with everything passing, authentication isn't the problem. See Why Are My Google Workspace Emails Going to Spam?.

When to get help

If your DMARC reports show sources you can't identify, or you're ready for p=reject and nervous about what it will break, that's a good point to have someone experienced look at the reports with you. Get in touch.

FAQ

Do I need DKIM if SPF is already passing?

Yes. SPF breaks when mail is forwarded, and DKIM doesn't. With both in place, DMARC has two chances to pass. Bulk senders to Gmail are required to have both.

Should I use ~all or -all in my Google Workspace SPF record?

Google recommends ~all. Once DMARC is at enforcement, the receiver acts on the DMARC policy for mail that fails both checks, so the difference between ~all and -all matters less than getting DKIM and DMARC right.

Why does the Admin console still say DKIM isn't set up?

Usually the DNS record hasn't propagated, or it was pasted incorrectly. Google says the warning can persist for up to 48 hours even when the record is right, so check the published value before changing anything.

Do I need separate records for each domain in my Workspace account?

Yes. Each domain and each sending subdomain needs its own SPF record and its own DKIM key generated in the Admin console. A DMARC record on the parent domain covers subdomains unless you publish a separate one.

Sources

Related guides

Still stuck?

Some deliverability problems take an experienced eye to untangle. Tell me what you're seeing and I'll tell you what I'd check first. The first 30-minute call is free.