Playbook · Marketing Sites · 22 November 2026
Set up SPF, DKIM and DMARC for Google Workspace on Cloudflare
Three DNS records that prove email from your domain really comes from you, so Gmail does not send it to spam or reject it. You add the three records in less than 5 minutes. Then they can take up to 48 hours to start to work.
Before
No records on the domain
- Gmail cannot tell your email from a fake one
- Your email goes to spam, or Gmail rejects it
- You do not know that it happens
After
SPF, DKIM and DMARC
- Gmail can make sure that the email is yours
- Your email goes to the inbox
- Cloudflare shows a daily report
We wrote this after we set up email authentication for a Client, as part of a Marketing Sites job. A marketing site gets people to act, and often you answer them by email. Your answer must get to their inbox, not to their spam folder.
Without these records, any server can send email that says it is from your domain. Gmail cannot tell your email from a fake one. Google says that email without SPF or DKIM can go to spam or be rejected. Since November 2025, Gmail rejects more of this email. The fix is three records, and you add them in less than 5 minutes.
In this guide, yourcompany.com is your domain. Your email runs on Google Workspace, and the DNS of the domain runs on Cloudflare.
The words in this guide
- A TXT record is a DNS record that holds a line of text.
- SPF is a TXT record that lists the servers that can send email for your domain.
- DKIM is a key that signs each email that you send. The receiver uses a TXT record to make sure that the signature is real.
- DMARC is a TXT record that tells receivers what to do when an email fails SPF and DKIM.
- A DMARC report is a daily summary that receivers send about the email that says it is from your domain.
Setups that go wrong
The picture at the top of this page shows the most common setup: no records at all. The two setups below also go wrong.
Two SPF records
A second SPF record
An old provider left its SPF record, and you add a new one. With two records, SPF fails for all your email.
Reject on day one
DMARC set to reject at the start
Receivers block email that fails. Email from a tool that you forgot, such as a newsletter tool, never comes.
Before you start
The DNS of your domain must run on Cloudflare. To set this up, read Buy your domain and give your developer access.
Your email must run on Google Workspace. To set this up, read Get a professional email on your domain with Google Workspace.
You need a Google Workspace super admin account and access to the domain in Cloudflare. Gmail must be on for your domain for 24 to 72 hours before Google gives you a DKIM key. Nothing in this guide costs money.
Step 1: Add the SPF record
Admin
dash.cloudflare.com → yourcompany.com → DNS → Records → Add record
- Look in the list of records for a TXT record that starts with
v=spf1. A domain must have only one. If there is one, addinclude:_spf.google.comto it and do not add a new record. - If there is no SPF record, click Add record. Set Type to
TXTand Name to@. - In Content, enter
v=spf1 include:_spf.google.com ~all. Click Save.
The ~all at the end tells receivers to treat email from other servers as suspect.
Step 2: Turn on DKIM
Admin
admin.google.com → Apps → Google Workspace → Gmail → Authenticate email
- Under Selected domain, choose
yourcompany.com. Click Generate New Record. - Set DKIM key bit length to 2048. Keep the prefix selector as
google. Click Generate. - Google shows a DNS Host name and a TXT record value. Copy them.
- In Cloudflare, go to
DNS → Records → Add record. Set Type toTXTand Name togoogle._domainkey. Paste the TXT record value into Content and click Save. Cloudflare splits a long value into parts, and receivers join the parts again. - Go back to Authenticate email in Google and click Start authentication.
DKIM can take up to 48 hours to start to work. Until then, Google can show You must update the DNS records for this domain.
Step 3: Add the DMARC record
Admin
Start with the policy p=none. With this policy, receivers send you reports, but they do not block any email. Then you can find each service that sends email for you before you block anything.
dash.cloudflare.com → yourcompany.com → DNS → Records → Add record
- Click Add record. Set Type to
TXTand Name to_dmarc. - In Content, enter
v=DMARC1; p=none. Click Save.
Step 4: Send the DMARC reports to Cloudflare
Admin
A DMARC record usually sends its reports to a mailbox. The reports are files that nobody reads. Cloudflare DMARC Management gets the reports for you and shows them as a dashboard in Cloudflare. It is available on all Cloudflare plans.
dash.cloudflare.com → yourcompany.com → Email → DMARC Management
- Click Enable DMARC Management.
- Cloudflare finds the record from step 3 and adds a Cloudflare address to it as
rua, the address for reports. Click Next.
The first report can take up to 24 hours to come.
Step 5: Test it
Admin
- From your Google Workspace account, send an email to a personal Gmail address.
- In the personal Gmail, open the email. Click the three dots next to Reply, then click Show original.
- Make sure that SPF, DKIM and DMARC each show PASS.
If DKIM does not pass, wait. It can take up to 48 hours. Make sure that the name of the DKIM record is google._domainkey and that you clicked Start authentication. If SPF does not pass, make sure that the domain has only one TXT record that starts with v=spf1.
Later: make DMARC strict
Admin
dash.cloudflare.com → yourcompany.com → Email → DMARC Management
- A few weeks after step 4, look at the reports. Make sure that all the email that you send passes. If a service that sends email for you fails, such as a newsletter tool, add it to SPF and DKIM first.
- In
DNS → Records, edit the_dmarcrecord. Changep=nonetop=quarantine. Keep the Cloudflareruaaddress that is there.
With p=quarantine, receivers send email that fails to spam.