Why WordPress Emails Go to Spam in Gmail: SPF, DKIM and DMARC for Small Sites
WordPress emails landing in Gmail spam? Read the message headers, fix the From address, then set up SPF, DKIM and DMARC the way Google's rules require.
Your WordPress site sends emails — contact-form messages, order confirmations, password resets — but they land in Gmail’s spam folder. People never see them, so enquiries and orders can go missing.
This usually happens because Gmail can’t tell that the email really comes from your domain (your website’s name, like yourdomain.com). This guide shows you how to prove that, so Gmail can trust your mail.
In this guide you’ll learn:
- How to look at a test email in Gmail and read the clues. That’s the Show original screen.
- How to use a real From address on your own domain, instead of a default that may not even exist.
- How to set up three small records at your domain, called SPF, DKIM and DMARC. In plain words: SPF is a list of who is allowed to send mail for you; DKIM is a stamp that proves the message wasn’t faked; DMARC tells Gmail what to do if those checks fail.
- How to send through a proper mail service, not just the website on its own.
Since 2024, Google’s rules say everyone sending to personal Gmail accounts needs SPF or DKIM. If you send 5,000 or more messages a day, you need all three, including DMARC. By the end, you should be able to send a test and see it arrive in the inbox, not spam.
Who this guide is for
- Site owners whose contact-form notifications, WooCommerce emails or password resets end up in Gmail spam.
- Small businesses that send a few hundred emails a day or fewer. This guide doesn’t cover bulk marketing.
- Anyone who has fixed "not sending at all" and now has "sending, but to spam".
If your WordPress emails don’t arrive at all, start with our guide to fixing Contact Form 7 not sending email.
What you need before you start
- Admin access to WordPress.
- Access to your domain’s DNS settings, at your registrar, host or DNS provider such as Cloudflare.
- To know which service sends your site’s mail: your web host, or an SMTP or email API service.
- A personal Gmail address to receive test messages.
Contents
- Confirm the problem with a test email
- Read the authentication results in Gmail
- Fix the From address
- Find out what really sends your mail
- Set up or fix SPF
- Turn on DKIM
- Add a DMARC record
- Re-test and keep it healthy
- Common errors
- Troubleshooting
- Alternatives and limitations
- FAQ
Step 1: Confirm the problem with a test email
Trigger a typical site email (submit your contact form, or request a password reset for a test user) and send it to a personal Gmail address (@gmail.com).
Google says its sender guidelines apply to mail sent to personal Gmail accounts, not to Google Workspace inboxes. So test with a personal address.
Since 2024, those guidelines require everyone sending to personal Gmail accounts to use SPF or DKIM. Senders of 5,000+ messages a day need SPF, DKIM and DMARC.
Note where it lands: Inbox, Spam, or nowhere. "Nowhere" is a different problem (see the guide linked above).
Step 2: Read the authentication results in Gmail
- Open the test email in Gmail on a computer.
- Next to Reply, click More (⋮) → Show original.
- At the top, check the SPF, DKIM and DMARC results. You want PASS, and you want the domains shown to be your domain.
- Click Copy to clipboard if you want to share the header with your host. Remove personal addresses first.
How to read it:
| What you see | Meaning | Go to |
|---|---|---|
| SPF: FAIL or SOFTFAIL | The sending server isn’t listed in your domain’s SPF record | Steps 4–5 |
| SPF: PASS, but for a host’s domain (for example the server’s hostname) | It passed, but not for your domain, so it won’t align with your From address | Steps 4–6 |
| DKIM missing, or signed by another domain | No DKIM signature for your domain | Step 6 |
| DMARC: FAIL | Neither SPF nor DKIM passed for the domain in your From address | Steps 3–7 |
| All PASS, still in spam | Authentication is fine; look at content, reputation and volume | Step 8 |
Exact layout of the Show original summary to be confirmed with screenshots.
Step 3: Fix the From address
If nothing overrides it, WordPress core’s wp_mail() sends from the name "WordPress" and the address wordpress@ + your site’s domain (with www. removed). A comment in the WordPress source warns that some hosts block mail from this address if the mailbox doesn’t exist. The wp_mail_from documentation says it’s highly recommended that your From domain matches your website.
Do this:
- Create a real mailbox or alias on your domain, for example
hello@yourdomain.com. - Set it as the From address in each plugin that sends mail:
- the Mail tab in Contact Form 7;
- WooCommerce → Settings → Emails;
- your SMTP plugin, which can usually force one From address for all mail.
- Never use the visitor’s address (or any
@gmail.comaddress) as the From address. Put the visitor in Reply-To instead. Google’s guidelines say not to impersonate Gmail From: headers, and that Gmail will begin using a DMARC quarantine enforcement policy. When we looked up_dmarc.gmail.comon 12 November 2026, it publishedp=none; sp=quarantine.
If no plugin sets the address, a small snippet can. Add it with a code-snippets plugin or a child theme, and change the values:
<?php
// Set a From address on your own domain for all wp_mail() emails.
add_filter( 'wp_mail_from', function ( $from ) {
return 'hello@yourdomain.com';
} );
add_filter( 'wp_mail_from_name', function ( $name ) {
return 'Your Business Name';
} );
Uses the documented wp_mail_from and wp_mail_from_name filters. We have not run this snippet on a test site. Test it on staging first. An SMTP plugin’s "force From" setting can override this. Use one method, not both.
Step 4: Find out what really sends your mail
SPF and DKIM must cover the system that actually delivers the message. That’s one of:
- Your web host’s mail server. This is the default when WordPress uses PHP mail.
- An SMTP service or email API connected through an SMTP plugin, for example Google Workspace, Microsoft 365, or a transactional email service.
Your mailbox provider and your website’s sender are often different. For example, your mailboxes may be on Google Workspace while the website sends through the host. Both need to be covered.
Recommendation: send website mail through an authenticated SMTP service or email API that gives you SPF and DKIM records for your domain. Our free SMTP plugin comparison covers the WordPress side.
Step 5: Set up or fix SPF
Check what you have now. Open this address in a browser, replacing the domain with yours:
https://dns.google/resolve?name=yourdomain.com&type=TXT
This is Google Public DNS’s documented JSON API. Look in "Answer" for a record starting with v=spf1. When we ran the same lookup for google.com on 12 November 2026, the result included:
google.com. type 16 v=spf1 include:_spf.google.com ~all
(Type 16 means a TXT record.)
Edit it, following Google’s SPF rules:
- The record starts with
v=spf1. Add aninclude:for each service that sends for your domain, and end with~all. Google recommends~all. - Google allows up to 10
include:tags. - Keep one SPF record per domain (RFC 7208). If one exists, add to it. Don’t create a second.
Examples from Google’s SPF help (use your provider’s exact value):
| Who sends for your domain | SPF record (example) |
|---|---|
| Google Workspace only | v=spf1 include:_spf.google.com ~all |
| Google Workspace + Microsoft 365 | v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all |
| Google Workspace + Amazon SES | v=spf1 include:_spf.google.com include:amazonses.com ~all |
| GoDaddy only | v=spf1 include:secureserver.net ~all |
Web host sending? Ask your host for the exact SPF include or IP to add. Don’t guess.
We have not made DNS edits on a test domain. DNS changes can take time to spread.
Step 6: Turn on DKIM
DKIM adds a signature that proves the message wasn’t altered and was authorised by your domain. The process is the same everywhere:
- In your sending service’s dashboard (host, Google Workspace or email service), generate a DKIM key for your domain. Google recommends a 2048-bit key if your DNS provider supports it; 1024 if not.
- Add the TXT (or CNAME) record it gives you at your DNS provider. The name is
selector._domainkey. For Google Workspace, Google’s example selector isgoogle, givinggoogle._domainkey. - Go back to the sending service and click Verify, Start authentication or similar.
- Send a new test and confirm that DKIM: PASS for your domain in Show original.
Google’s DKIM help notes that some providers limit TXT record length, and that the Admin console can show a "You must update the DNS records" message for up to 48 hours. Patience is normal here.
Step 7: Add a DMARC record
DMARC tells receiving servers what to do with mail that fails SPF and DKIM alignment with your From domain. It also sends you reports.
Google says to wait 48 hours after setting up SPF and/or DKIM before enabling DMARC.
Start in monitoring mode. Add a TXT record with this host and value:
Host: _dmarc
Value: v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com
p=nonemeans "monitor only". Google’s guidelines acceptp=nonefor bulk senders.ruais where aggregate reports go. Use a mailbox you’ll check, or a DMARC report service.- Google’s example also adds
adkim=s; aspf=s(strict alignment). RFC 7489 says that if you leave them out, both default to relaxed (r). Relaxed alignment lets mail from a subdomain, such as a sending service’smail.yourdomain.com, still align. That’s usually safer for a small site starting out. - Once reports show your real mail passing, you can move to
p=quarantine, optionally withpct=for a gradual rollout.
Alignment is the key idea. Gmail’s guidelines say the domain in your From: header must align with the SPF domain or the DKIM domain. DKIM signing with your domain is the most reliable way to get there.
Confirm the result with Show original after your DNS changes have spread. We have not made these DNS edits on a test domain.
Step 8: Re-test and keep it healthy
- Send new test emails to a personal Gmail address and check Show original. Aim for SPF, DKIM and DMARC: PASS.
- If the mail still goes to spam after a pass, check the content and practices:
- Only email people who expect it.
- Avoid misleading subject lines.
- Make sure links point to your own domain.
- Google’s guidelines also require valid forward and reverse DNS (PTR) for sending IPs, TLS, RFC 5322-formatted messages, and spam rates in Postmaster Tools below 0.3%. A reputable SMTP service handles most of this for you.
- Google Postmaster Tools: add and verify your domain with a DNS TXT record. Google says Postmaster data only applies to mail sent to personal Gmail accounts.
Common errors
| Error or symptom | Likely cause | Fix |
|---|---|---|
| Bounce with 5.7.26 | Unauthenticated mail (Google’s guidelines name this code) | Steps 5–7 |
| Bounce with 5.7.25 | Sending IP has no valid PTR record (Gmail sender FAQ) | Ask your host or SMTP service |
| Temporary error 4.7.32 (rate limited) | From: not aligned with the authenticated SPF or DKIM domain (sender FAQ) | Steps 3, 6 |
| Two SPF records | Records added by different services | Merge them into one |
| SPF stops passing after you add more services | Too many include: tags |
Remove services you no longer use. Google allows up to 10 include: tags. |
| DMARC fails even though SPF passes | SPF passed for the host’s domain, not yours | DKIM-sign with your domain (Step 6) |
| Form emails "from" visitors’ Gmail addresses | The visitor’s address is used as the From | Use your domain in From and the visitor in Reply-To (Step 3) |
Troubleshooting
- Changed DNS but nothing changed: check the record with the
dns.googlelookup in Step 5. If it’s not there yet, wait and check again. Make sure you edited DNS at the provider that actually hosts your domain’s DNS, which may be Cloudflare rather than your registrar. - Workspace colleagues receive fine, Gmail users don’t: expected. Google’s sender requirements only apply to personal Gmail accounts.
- Only WooCommerce emails go to spam: check WooCommerce’s own From address (WooCommerce → Settings → Emails). Plugins can each set their own.
- Everything passes but some mail still goes to spam: authentication is necessary but not sufficient. Check content and complaint rates, and send less to people who didn’t ask for it.
Alternatives and limitations
- Use your email provider’s SMTP (for example Google Workspace or Microsoft 365) for low volumes. Check their sending limits.
- Use a transactional email service: these are designed for website mail and give you DKIM and SPF records.
- Limitations:
- We can’t promise inbox placement. Gmail also uses reputation and recipient feedback.
- Some cheap hosts don’t let you add DKIM for PHP mail.
- DNS panels differ, so follow your provider’s own instructions for field names.
FAQ
Do I need DMARC if I send only a few emails a day?
Gmail’s minimum for all senders is SPF or DKIM. DMARC is required for senders of 5,000+ messages a day. A p=none DMARC record is still a sensible, low-risk step, because it gives you reports.
What’s the difference between SPF, DKIM and DMARC?
- SPF lists the servers allowed to send for your domain.
- DKIM signs each message for your domain.
- DMARC checks that one of them matches your From domain, and says what to do if not.
Should I use -all instead of ~all?
Google recommends ~all in its SPF help.
Can WordPress send directly without an SMTP plugin?
Yes, through your host’s mail server, but you then depend on your host’s SPF, DKIM and IP reputation. An authenticated SMTP service gives you more control.
Why does Gmail say "via" another domain next to my sender?
Usually because the message was signed or sent by a different domain than your From address. Set up DKIM for your own domain at the sending service. Exact Gmail wording to be confirmed.
Official references
- Gmail Help: Email sender guidelines, Email sender guidelines FAQ, Trace an email with its full header (Show original), Set up Postmaster Tools
- Google Workspace Admin Help: Set up SPF, Set up DKIM, Set up DMARC
- Google Public DNS: JSON API for DNS over HTTPS
- WordPress: wp_mail(), wp_mail_from filter
- IETF: RFC 7489 (DMARC), RFC 7208 section 3.2 (one SPF record)
Next step
Choose how your site will send mail. Our comparison of free WordPress SMTP plugins covers the plugin side. Then re-run Step 2 to confirm everything passes.
Last updated: 13 November 2026



