SPF, DKIM and DMARC: a guide to authenticating email and improving deliverability
SPF, DKIM and DMARC help email providers recognize messages genuinely sent on behalf of your domain. They are essential for reducing spoofing, phishing and delivery issues affecting WordPress, WooCommerce, newsletters and professional email accounts.
However, they do not guarantee inbox placement. A message can pass authentication checks correctly and still be sent to spam because of domain or IP reputation, list quality, content, sending volume, links, attachments or a lack of consent.
The right approach is to inventory every service that sends email using your domain, enable DKIM with each provider, update the single SPF record, publish DMARC in monitoring mode, check the headers of real emails and apply stricter policies only after reviewing the results.
Recommended minimum configuration
- One valid SPF record for the relevant domain or hostname, including all authorized senders.
- DKIM enabled for every provider sending on behalf of the domain.
- An initial DMARC record with a
p=nonepolicy and an address for aggregate reports. - Addresses in the
From:field that are consistent with a domain you can authenticate. - Header tests for every important flow: business mailboxes, WordPress, WooCommerce, forms, CRM and newsletters.
Warning: before changing DNS, copy the values of existing records. Do not delete an SPF record to replace it with an example found online, and do not create multiple separate SPF records. An incomplete change can prevent legitimate services from passing authentication.
SPF, DKIM and DMARC explained simply
SPF: which servers can send email
SPF, short for Sender Policy Framework, is a DNS record that declares which servers, IP addresses or providers are authorized to send email for a domain.
SPF checks the domain used in the SMTP MAIL FROM command, also called the envelope sender. In a delivered message, this domain can usually be seen in the Return-Path field. It does not necessarily match the address the recipient sees in the From: field.
In practice, SPF answers this question: “Is the server that sent the message authorized to use the envelope sender domain?”
DKIM: the message signature
DKIM, short for DomainKeys Identified Mail, adds a cryptographic signature to an email. The sending provider keeps a private key, while the corresponding public key is published in DNS.
The recipient uses the public key to verify that the message was signed by the specified domain and that the parts protected by the signature have not been altered in transit.
In the headers, the domain that signs the message is shown by the d= parameter, while the key selector is shown by s=. For example:
DKIM-Signature: ... d=example.it; s=selector1; ...
DKIM does not prove that the recipient wants the message, nor does it replace proper list management or sending reputation.
DMARC: alignment between authentication and the visible sender
DMARC connects SPF, DKIM and the domain displayed in the From: field. To pass DMARC, it is not enough for SPF or DKIM to return pass: at least one of them must also be aligned with the domain in the From: header.
DMARC also allows the domain owner to publish a policy for non-compliant messages:
p=none: monitoring, without requesting specific action from the receiving server;p=quarantine: non-compliant messages are treated as suspicious;p=reject: the domain tells receivers that non-compliant messages should be rejected.
The policy is a request from the sending domain: the recipient provider decides how to apply it according to its own rules and assessments.
Gmail and Yahoo sender requirements
Gmail and Yahoo publish specific requirements for senders who deliver messages to their users. These requirements may change: before changing a production configuration, always check the official Gmail and Yahoo Sender Hub pages.
| Sender type | Gmail | Yahoo |
|---|---|---|
| Standard sender | Authentication with SPF or DKIM is required; Gmail also requires TLS for transmission. | Official best practices require domain authentication and a properly configured sending infrastructure. |
| Bulk sender | Senders delivering more than 5,000 messages per day to personal Gmail accounts must use SPF, DKIM and DMARC, with the domain in From: aligned with SPF or DKIM. |
Senders delivering more than 5,000 messages per day must use SPF, DKIM and a published DMARC policy. |
| Marketing or subscription messages | Bulk senders must provide appropriate unsubscribe mechanisms, including one-click unsubscribe where required. Gmail recommends keeping the spam rate below 0.30% in Postmaster Tools. | Messages must provide a clear unsubscribe option and follow the provider’s stated practices. |
These requirements do not mean small senders can ignore SPF, DKIM and DMARC: authentication is also useful for transactional email, WordPress notifications and business mailboxes.
SMTP, email authentication and deliverability: the differences
An SMTP service or transactional API defines the infrastructure through which a message is sent. It may be your hosting provider, Google Workspace, Microsoft 365, a dedicated SMTP service or a transactional platform.
SPF, DKIM and DMARC do not send email: they allow the recipient to verify the sender’s technical identity and its consistency with the domain displayed in the message.
For WordPress, a properly configured SMTP plugin or API integration is often preferable to sending directly from the hosting server. However, the plugin does not automatically create SPF records, enable DKIM or ensure DMARC alignment: these functions depend on the mailer or provider actually configured.
What a successful wp_mail() result means
WordPress uses the wp_mail() function to process sending requests. A positive result means WordPress did not detect an error during its own sending step.
It does not prove that the message was received, that it passed SPF, DKIM and DMARC, or that it reached the inbox. Verification must be performed on the headers of the message actually received.
Before DNS: inventory all senders
Before publishing a restrictive DMARC policy, identify every service that sends using your domain, including those used infrequently.
| Sending source | Examples | What to check |
|---|---|---|
| Business mailboxes | Google Workspace, Microsoft 365, hosted email | SPF, DKIM and domain in From: |
| WordPress and WooCommerce | Password resets, orders, notifications | SMTP/API mailer, From:, DKIM and DMARC |
| Contact forms | Inquiries and quote requests | Domain-based From: and visitor Reply-To |
| Newsletters | Campaigns, automations, subscription confirmations | Authenticated domain, DKIM and unsubscribe option |
| CRM and help desk | Tickets, quotes, follow-ups | DKIM d= domain and envelope sender |
| Other software | Invoicing, booking, business systems, scanners | Actual provider and required DNS records |
For every service, note the provider, the address used in From:, the DKIM d= domain, the envelope sender domain and the test result. This map is essential for distinguishing legitimate sends, incomplete configurations and impersonation attempts.
How to configure SPF without errors
SPF is a TXT DNS record. This is an educational example for a domain that sends exclusively through Google Workspace:
Type: TXT
Name: @
Value: v=spf1 include:_spf.google.com -all
Do not copy this value if you also use a transactional provider, newsletter platform, CRM or other services. Do not add include mechanisms for providers you do not use, and do not overwrite an existing record without first including the necessary authorizations.
Only one SPF record per hostname
There must be only one SPF record for the same hostname. Multiple TXT records beginning with v=spf1 can cause a permerror result.
Authorizations for Google Workspace, WordPress, CRM and newsletters must be combined into a single record, following each provider’s instructions.
Common SPF errors
- Multiple SPF records: combine the authorizations into one record.
- Forgotten senders: check invoicing software, booking systems, forms and legacy applications.
- More than 10 DNS lookups: overly long chains of
include,a,mx,redirectorexistscan generatepermerror. - Applying
-allwithout an inventory: it is useful after identifying senders, but an omitted source will fail SPF. - Confusing SPF and From: SPF checks the envelope sender; by itself, it does not authenticate the visible domain in
From:.
The most common SPF results are:
pass: the server is authorized by the SPF record;fail: the record says the server is not authorized;softfail: the record indicates that the server is probably not authorized;neutral: the record does not state a specific policy for that server;permerror: a permanent error, such as multiple records or too many lookups;temperror: a temporary DNS evaluation error.
The SPF specification is available in RFC 7208.
How to enable DKIM
DKIM is enabled through the provider that sends your email. Google Workspace, Microsoft 365, newsletter platforms and SMTP or API services may use different procedures, but the principle is the same: the provider signs messages and you publish the public key, or a record delegating it to the provider, in DNS.
TXT or CNAME: use the required type
Some providers supply a TXT record containing the DKIM public key; others require CNAME records. Copy the type, name and value specified by the service exactly.
Do not change a required CNAME into a TXT record, replace a TXT record with a CNAME, or modify the selector. A CNAME also cannot coexist with other records at the same hostname.
Selectors and key rotation
A DKIM record normally has a name similar to this:
selector1._domainkey.example.it
selector1 is the selector. Different providers may use different selectors, and the same provider may change them during key rotation.
During a rotation, do not immediately delete the old record: messages signed shortly before the change may still be in delivery and require the previous key.
Essential technical requirements
Use rsa-sha256 signatures and avoid rsa-sha1. DKIM keys must be at least 1,024 bits; when your provider and DNS allow it, a 2,048-bit key is preferable. For details, see RFC 6376 and RFC 8301.
Cloudflare and DNS control panels
In Cloudflare and other DNS control panels, add the record using the type, name and value supplied by the provider. If the service requires DKIM CNAME records, they should normally be set to DNS only, not proxied. Underscores in names such as _domainkey and _dmarc are normal.
The procedure for creating DNS records is described in the Cloudflare documentation.
How to create a DMARC record
A DMARC record is a TXT DNS record published on the _dmarc subdomain. A cautious initial example is:
Type: TXT
Name: _dmarc
Value: v=DMARC1; p=none; rua=mailto:dmarc@example.it
For example.it, the record is published as _dmarc.example.it. Replace the address in the rua tag with a mailbox you can receive and manage.
The p=none policy lets you collect data about messages using the domain without explicitly asking recipients to quarantine or reject them.
DMARC reports: how to use them
The rua tag specifies the destination for aggregate reports. They are normally XML files, often compressed, that show observed sending sources, SPF and DKIM results, and their alignment.
Reports help identify forgotten providers, misconfigured services and unauthorized sending. If the rua tag points to an address on an external domain, the domain receiving the reports must publish the relevant DMARC DNS authorization; without it, some receivers may not send reports to that destination.
Services are available to make XML reports easier to read, but before using one, ensure it is trustworthy and clearly identifies the detected sending sources.
A note on the DMARC standard
RFC 9762 has made the earlier RFC 7489 obsolete as the DMARC reference. For an initial configuration, an essential record with p=none and rua is preferable. Avoid unnecessary tags until you have verified your domain’s needs and the current documentation of the providers involved.
DMARC alignment: why SPF or DKIM pass is not enough
DMARC passes when either SPF or DKIM returns pass and is aligned with the domain in the From: field.
Example of successful alignment
From: support@example.it
DKIM d=example.it → pass
DMARC → pass
The DKIM domain matches the one shown to the recipient, so alignment is satisfied.
Example of failed alignment
From: support@example.it
DKIM d=provider-email.example → pass
SPF → pass for provider-email.example
DMARC → possible fail
SPF and DKIM may be valid for the provider’s technical domain, but DMARC can fail because that domain is not aligned with example.it, the domain visible in From:.
With relaxed alignment, which is normally the default, a subdomain and the organizational domain can be considered aligned: for example, news.example.it and example.it. With strict alignment, the domains must match exactly.
WordPress, WooCommerce and contact forms
Do not use the visitor’s email address in From
In WordPress contact forms, a common mistake is setting the visitor’s submitted address as the sender:
From: mario.rossi@gmail.com
Your site is not authorized to send messages as a visitor’s Gmail address. This configuration can cause authentication, DMARC alignment and deliverability problems.
Use a domain-based From address and the visitor’s Reply-To
The recommended configuration is:
From: Example Site <wordpress@example.it>
Reply-To: mario.rossi@gmail.com
This way, the email is sent from an address on your domain, which you can authenticate. The operator’s reply will still be sent to the visitor’s address through the Reply-To field.
The address in From: must exist or be authorized by the configured mailer. Also check that the plugin properly validates the address entered in the Reply-To field.
Tests to run in WooCommerce
After configuring the mailer and DNS, send separate tests for:
- new order;
- completed order;
- password reset;
- account creation;
- contact form notification;
- emails from membership, booking, CRM or ticketing plugins.
A successful WooCommerce test does not prove that the contact form or other plugins are configured correctly as well: some extensions may use different settings or headers.
How to verify SPF, DKIM and DMARC
1. Check DNS records
Check the type, name and value of your records. After a change, visibility depends on the DNS TTL and resolver caches.
From a terminal, you can run the following commands, replacing the domain:
dig TXT example.it
dig TXT _dmarc.example.it
dig TXT selector1._domainkey.example.it
On Windows, you can also use:
nslookup -type=TXT example.it
nslookup -type=TXT _dmarc.example.it
However, the presence of a DNS record is not sufficient proof: you must verify that the email sent uses it correctly.
2. Send tests from every source
Send a test email from the business mailbox, WordPress, WooCommerce, the contact form, newsletter platform and CRM. Keep the messages you receive and compare their headers.
3. Read Authentication-Results
In Gmail, open the message menu and select the option to view the original. In Outlook, you can view the message headers. Look for a section similar to this:
Authentication-Results: mx.example.net;
spf=pass smtp.mailfrom=bounce.example.it;
dkim=pass header.d=example.it;
dmarc=pass header.from=example.it;
This example shows that:
- SPF passed for the
bounce.example.itenvelope sender; - DKIM passed with the
example.itdomain; - the visible domain in the
From:header isexample.it; - DKIM is aligned with
From:, so DMARC passes.
Google also provides Google Admin Toolbox Messageheader to analyze headers copied from a message. Diagnostic tools are useful, but analyzing real emails sent by every source remains the most reliable test.
Common issues and fixes
The SMTP plugin works, but emails go to spam
Check the provider actually used by the plugin and the message headers. In particular, verify:
- SPF
passfor the actual mailer; - DKIM
passwith an aligned domain; - DMARC
pass; - a
From:field using your domain; - domain and IP reputation;
- recipient quality, consent and spam complaints;
- content, links and sending frequency;
- a clear unsubscribe option for marketing email.
SPF passes, but DMARC fails
Usually, SPF passes for the provider’s envelope sender domain while the From: field displays your domain. Check smtp.mailfrom, header.d and header.from in Authentication-Results: either SPF or DKIM must be aligned with From:.
DKIM passes, but the email goes to spam
DKIM verifies the signature, not campaign quality. Analyze spam complaints, inactive recipients, consent, volume, frequency, content, images, links and consistency between the message and recipients’ expectations.
Forwarded emails fail SPF
This is normal in some forwarding scenarios: the server delivering to the recipient may differ from the server authorized by the original sender’s SPF record. DKIM can help preserve authentication, provided forwarding does not alter elements covered by the signature.
After p=reject, some legitimate emails do not arrive
There is probably an unidentified or unaligned sending source. Identify the service in DMARC reports and headers, correct SPF, DKIM or From:, then test the flow again before keeping a restrictive policy.
When to move to quarantine and reject
- Inventory all sending sources.
- Enable DKIM for every legitimate source.
- Update the single SPF record without removing required authorizations.
- Publish DMARC with
p=noneand monitorrua. - Check the headers of the most important emails and review aggregate reports.
- Correct unaligned services, missing providers and anomalous senders.
- Consider
p=quarantinewhen legitimate sending is stable and recognized. - Move to
p=rejectonly after verifying relevant flows, including infrequent or seasonal ones.
Proceed with extra caution if the domain uses numerous SaaS services, legacy applications, shared infrastructure, invoicing or booking systems, multifunction scanners, or is undergoing an email migration.
Final checklist
- You have listed every source that sends email using the domain.
- You copied existing DNS records before changing them.
- Only one SPF record exists for the same hostname.
- The SPF record includes every provider actually in use.
- DKIM is active for business mailboxes, WordPress, newsletters and other relevant services.
- Addresses in the
From:field belong to a domain you can authenticate. - WordPress forms use the visitor in
Reply-To, not inFrom:. - You published DMARC with
p=noneand a monitoredruaaddress. - You checked DNS and email headers for messages sent from different sources.
- Relevant headers show
spf=pass,dkim=passanddmarc=pass. - For marketing email, you verified consent, unsubscribe options and list quality.
- You reviewed DMARC reports before applying
quarantineorreject.
Official sources and documentation
- RFC 7208 — Sender Policy Framework
- RFC 6376 — DomainKeys Identified Mail
- RFC 8301 — DKIM cryptographic requirements
- Gmail — Email sender guidelines
- Yahoo Sender Hub — Best practices
- Microsoft Learn — Email authentication
- WordPress Developer Resources — wp_mail()
- Cloudflare — Create DNS records
SPF, DKIM and DMARC protect your domain identity and help receiving providers evaluate email correctly. To achieve reliable results, every sending source must be known, authorized, aligned and verified through the headers of real messages.











