Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Setup & site building · Guide

How to Set Up SPF, DKIM and DMARC for WordPress Email

Short answer

To set up SPF, DKIM and DMARC for WordPress email, add one SPF TXT record at your domain root, generate a DKIM key in your mail provider and publish it in DNS, then add a DMARC TXT record at _dmarc starting at p=none. Connect WordPress to the same mail service with an SMTP plugin, then send a test mail and check that SPF, DKIM and DMARC all pass.

Key takeaways

  • SPF lists the servers allowed to send mail for your domain, DKIM signs each message, and DMARC tells receivers what to do when a check fails.
  • Publish only one SPF TXT record per domain, because a second v=spf1 record makes SPF fail.
  • Gmail requires SPF or DKIM from every sender, and bulk senders of 5,000 or more messages a day need SPF, DKIM and a DMARC record.
  • Start DMARC at p=none, read the reports for at least a week, and only then move to p=quarantine or p=reject.
  • Allow up to 48 hours for SPF and DKIM to start working, and wait 48 hours after they pass before you add DMARC.

What do SPF, DKIM and DMARC do for WordPress email?

SPF lists the servers allowed to send mail for your domain, DKIM signs each message so receivers can check it was not changed, and DMARC tells receivers what to do when either check fails.

WordPress sends password resets, order mail and form notices from your domain, so receivers check these records before they trust the message. Google explains that DKIM stops message contents being changed in transit. SPF stops senders from impersonating you by blocking spammers who send mail that appears to come from your organisation. About authentication methods

DMARC adds the missing piece: a policy and a report address. Without it, a receiver that sees a failed check has no instruction from you about what to do with the message.

The three records work as a set. Google recommends setting up both DKIM and SPF, then adding DMARC, because the pair sends a stronger signal than either one alone.

Gmail also sets a volume line: every sender to personal Gmail accounts needs SPF or DKIM. Bulk senders of 5,000 or more messages a day need both plus DMARC, with p=none accepted. See email marketing costs for a WordPress site before you plan volume sends.

What do you need before you start?

You need access to your domain DNS, a list of every service that sends mail as your domain, and admin access to your mail provider.

Gather these four things first:

  • Your DNS host login, which is often your registrar or Cloudflare.
  • Every sender: your WordPress host, Google Workspace or Microsoft 365, your form plugin mailer and any newsletter tool.
  • A mailbox for DMARC reports, such as [email protected].
  • About 30 to 60 minutes for the setup, plus waiting time for DNS.
RecordTypeDNS nameExample value
SPFTXT@v=spf1 include:_spf.google.com ~all
DKIMTXT or CNAMEgoogle._domainkeyv=DKIM1; k=rsa; p=... (key from your provider)
DMARCTXT_dmarcv=DMARC1; p=none; rua=mailto:[email protected]

The values in the table come from your mail provider. Never copy a DKIM key from a guide, because each key belongs to one domain and one provider. Cloudflare shows the same three record names and values in its Google Workspace DNS setup.

How do you add an SPF record for WordPress email?

Add one TXT record at the root of your domain with a value that lists every service allowed to send mail for it.

  1. List every service that sends mail as your domain, including your host, your mail provider and any newsletter tool.
  2. Open your DNS host and go to DNS, then Records, and select Add record.
  3. Set Type to TXT, Name to @ for the domain root, and paste your SPF value.
  4. Save the record and check that only one TXT record starting with v=spf1 exists.

If Google Workspace is your only sender, use this value:

v=spf1 include:_spf.google.com ~all

If Microsoft 365 is your only sender, use this value instead, as shown in Microsoft's SPF setup:

v=spf1 include:spf.protection.outlook.com -all

When you have more than one sender, merge them into the same record with extra include: entries, such as v=spf1 include:_spf.google.com include:sendgrid.net ~all. You can only publish one SPF record per domain, and a second v=spf1 record makes SPF fail. Cloudflare notes this in its email troubleshooting guide.

SPF checks are capped at 10 DNS lookups, so each include: counts toward that limit. Keep the list short and remove senders you no longer use.

How do you set up DKIM for WordPress email?

Generate the DKIM key in your mail provider, publish the public key in DNS, then switch signing on.

For Google Workspace, follow these steps:

  1. Sign in to the Google Admin console and go to Apps, then Google Workspace, then Gmail, then Authenticate email.
  2. Select your domain, choose a 2048-bit key, and click Generate new record.
  3. Add a TXT record named google._domainkey with the value Google shows, which starts with v=DKIM1; k=rsa; p=...
  4. Wait for the DNS record to appear, then return to Authenticate email and click Start authentication.

Google recommends a 2048-bit key, with 1024 bits as the minimum. A new domain may need 24 to 72 hours after Gmail setup before the Admin console lets you generate a key, and DKIM can take up to 48 hours to start working once you turn it on.

For Microsoft 365, publish two CNAME records, selector1._domainkey and selector2._domainkey, with the targets shown in the Defender portal. Then open Email and collaboration, Policies and rules, Threat policies, then Email authentication settings. Open the DKIM tab and turn on signing, because it does not sign custom-domain mail until you do this.

How do you add a DMARC record?

Add one TXT record named _dmarc with a starting policy of p=none and a report address, after SPF and DKIM pass.

  1. Wait at least 48 hours after SPF and DKIM are set up, as Google advises.
  2. Add a TXT record with Name _dmarc and this content, using your own report address: v=DMARC1; p=none; rua=mailto:[email protected]
  3. Read the aggregate reports for at least a week and fix any legitimate sender that fails.
  4. Change the policy to p=quarantine, watch for another week, then move to p=reject.

The three policies mean different things. The p=none policy only monitors, p=quarantine sends failed mail to spam or junk, and p=reject blocks it. Cloudflare lists the same three policies in its email authentication docs and notes that its Email Service adds a p=reject record when a domain has none.

Cloudflare users can also use Email, then DMARC Management, which adds the record and reads the aggregate reports in the dashboard. See the DMARC Management security records for the exact menu path.

How do you connect WordPress to your mail service with SMTP?

Install WP Mail SMTP, pick your mailer, enter the SMTP host, port and login, then send a test mail.

  1. In your WordPress dashboard, go to Plugins, then Add New, search for WP Mail SMTP, then install and activate it.
  2. Go to WP Mail SMTP, then Settings, and set From Email to the address that matches your SMTP account.
  3. Choose Other SMTP, enter the host your provider gives you, set Encryption to TLS and Port to 587, or SSL and Port 465, and turn Authentication on.
  4. Go to WP Mail SMTP, then Tools, then Email Test, and send a test to your own address.

The port and encryption pair comes from your mail host. DreamHost documents TLS on port 587 for its WP Mail SMTP setup, and 465 with SSL is the other common pair.

The From Email must match the account you log in with, or receivers may reject the mail. If forms still fail after SMTP works, see our guide on how to fix WPForms not sending email.

SMTP only carries the mail. It does not create SPF, DKIM or DMARC, so your DNS records still decide whether receivers trust the message. The plugin page for WP Mail SMTP describes it as the route that sends WordPress mail through a mail service instead of the web server.

How do you check that SPF, DKIM and DMARC work?

Send a test mail to a Gmail address, open Show original, and check that SPF, DKIM and DMARC all say PASS.

Use these three checks:

  • In Gmail, open the test message, click the three dots, then Show original, and look for Authentication-Results with spf=pass, dkim=pass and dmarc=pass.
  • In a terminal, run dig TXT _dmarc.yourdomain.com +short and dig TXT yourdomain.com +short to confirm both records are live.
  • In Google Postmaster Tools, check your spam rate and keep it below 0.3%, with Google advising below 0.1%.

Check the From domain too. Google requires the From domain to align with the SPF domain or the DKIM domain for bulk senders, and only one of the two needs to align. The Gmail sender guidelines FAQ lists this alignment rule alongside the 5,000-messages-a-day bulk sender line.

How long does it take for SPF, DKIM and DMARC to work?

Allow up to 48 hours for each record to take effect, though many DNS changes show up within minutes.

Google says SPF and DKIM can each take up to 48 hours to start working after you publish them. Cloudflare notes that Google usually verifies a domain within a few minutes, while DNS propagation can take up to 48 hours.

Wait at least 48 hours after SPF and DKIM before you add DMARC, then watch reports for at least a week at p=none before you tighten the policy. Rushing to p=reject is the most common way to block your own mail.

If a record does not show up yet, read our guide on how long DNS propagation takes before you change anything. A record that looks missing is often just cached somewhere between your DNS host and the receiver.

What mistakes should you avoid?

The most common errors are easy to prevent if you check each one before you move on.

  • Publishing two SPF records instead of merging every sender into one.
  • Copying a DKIM key from a guide or another domain instead of generating your own.
  • Jumping straight to p=reject before the reports show that legitimate mail passes.
  • Forgetting a sender, such as a newsletter tool or a form plugin, and leaving it out of SPF. If a form tool sends mail as your domain, connect WPForms to Mailchimp only after that sender is in your SPF record.
  • Setting the WordPress From Email to an address that does not match your SMTP login.
  • Never reading DMARC reports, so a failing sender goes unnoticed for weeks.

Fix one record at a time and test after each change. When SPF, DKIM and DMARC all pass on a test mail, leave the records alone and review the DMARC reports each month.

Frequently asked questions

Do I need all three records, or is SPF enough?

SPF alone is not enough for most sites. SPF lists allowed senders, DKIM proves the message was not changed, and DMARC tells receivers what to do when a check fails. Gmail requires SPF or DKIM from every sender, and bulk senders need all three. Set up SPF and DKIM first, then add DMARC at p=none.

Can I use SPF, DKIM and DMARC if WordPress sends mail from my host?

Yes. The records live in DNS, not in WordPress, so they work no matter which server sends the mail. List your host as a sender in SPF, or better, send through your mail provider with an SMTP plugin and list that provider instead. The From address must match the domain the records belong to.

Why does my mail still go to spam after I add the records?

First check that all three checks pass in Gmail Show original, because a single failing record can send mail to spam. Then check your spam rate in Google Postmaster Tools, which must stay below 0.3 percent. Content, list quality and sending history also affect spam placement, so authentication alone does not guarantee the inbox.

How often should I check my DMARC reports?

Check them weekly while you run p=none, then at least once a month after you reach p=reject. Reports show every source sending as your domain, including ones you forgot. A new failing source usually means a new tool was connected without updating SPF or DKIM, so fix the record before mail starts failing.

What happens if I set DMARC to p=reject too early?

Receivers will reject mail that fails SPF and DKIM, including legitimate mail from a sender you forgot to list. Password resets, order confirmations and form notices can bounce without warning. Start at p=none, read the reports for at least a week, move to p=quarantine, and only then move to p=reject.

Sources

  1. About authentication methods Google Workspace Help
  2. Email sender guidelines FAQ Google Gmail Help
  3. Set up Google Workspace DNS records Cloudflare Docs
  4. Email authentication Cloudflare Docs
  5. Configure email security records Cloudflare Docs
  6. Set up SPF to help prevent spoofing Microsoft Learn
  7. WP Mail SMTP WordPress.org
  8. Configuring the WP Mail SMTP plugin DreamHost Help

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test