
- Three records, three different jobs
- The real difference between SPF, DKIM and DMARC
- What SPF checks
- What a DKIM signature proves
- DMARC and domain alignment
- How the three checks meet at the receiver
- A low-risk deployment order
- What these records do not protect
- Four checks after deployment
- Frequently asked questions
- Sources
Three records, three different jobs
SPF, DKIM and DMARC are related email authentication mechanisms, but they are not interchangeable. SPF lets a domain publish which systems may use its SMTP identities. DKIM associates a signing domain with a message through a cryptographic signature. DMARC compares authenticated SPF or DKIM identities with the sender domain visible to the recipient and publishes a policy for messages that fail that comparison.
SPF alone does not authenticate the visible sender address. A valid DKIM signature does not prove that a message is harmless or wanted. DMARC depends on a successful SPF or DKIM result whose authenticated domain aligns with the domain in the visible From address.
When diagnosing authentication, separate three questions: Was the connecting system authorised for the SMTP identity, which domain signed the message, and does either authenticated identity align with the visible From domain? DNS records become easier to interpret when each question is considered separately.
The real difference between SPF, DKIM and DMARC
SPF and DKIM do not both have to pass for DMARC to pass. One successful method is sufficient if its authenticated domain aligns with the visible sender domain. Configuring both is still useful because forwarding or message modification can break one authentication path while leaving the other intact.

| Mechanism | Question it answers | DNS record | Main limitation |
|---|---|---|---|
| SPF | May this IP address send using the relevant SMTP domain? | TXT | Its identity can change during forwarding |
| DKIM | Does the message have a valid signature for this domain? | TXT below a selector | Verification can fail if signed content changes |
| DMARC | Does an authenticated identity align with the visible sender? | TXT below _dmarc |
Depends on aligned SPF or DKIM |
All three publish information through DNS. If TXT records, record names and DNS zones are unfamiliar, read How DNS Works: Records, Settings and Troubleshooting before changing a production domain.
What SPF checks
SPF allows a receiving mail server to compare the connecting IP address with the policy published for an SMTP identity. The check normally uses the domain from the envelope sender supplied with MAIL FROM. For a null reverse-path, as used by some delivery status notifications, SPF constructs the MAIL FROM identity as postmaster@HELO-domain. Implementations can also check HELO independently. RFC 7208, section 2.4 defines this exception. SPF does not directly authenticate the From header displayed by a mail application.
This distinction matters because the visible sender and SMTP envelope sender are often different, especially when an external platform sends on behalf of a domain. DMARC is the layer that relates an SPF- or DKIM-authenticated domain to the address the recipient sees.
What an SPF record looks like
Hypothetical example:
example.com. TXT "v=spf1 ip4:192.0.2.10 include:_spf.example.net -all"
This illustrative record authorises 192.0.2.10 and sources permitted by the policy at _spf.example.net. The final -all means that a source matching none of the preceding mechanisms receives an SPF fail result. The example domains and address are documentation values, not settings to copy into a live zone.
Common SPF terms include:
v=spf1: Identifies the SPF version and must appear at the beginning of the record.ip4andip6: Authorise specific IP addresses or network ranges.include: Evaluates another domain’s SPF policy.a: Checks addresses returned by the specified domain’s A and AAAA records.mx: Checks addresses to which the specified domain’s MX hosts resolve.~all: Produces a softfail result for an unmatched source.-all: Produces a fail result for an unmatched source.
SPF evaluation permits no more than 10 DNS-querying terms during one evaluation, including nested policies, and exceeding that limit produces a permerror. The relevant terms are include, a, mx, ptr, exists and redirect. This is a limit on evaluated terms, not a count of every individual DNS packet; ip4, ip6 and all do not consume it. Unnecessary include, a and mx mechanisms should therefore be removed. Retired newsletter, support and CRM services can consume lookup capacity and leave obsolete sending paths authorised.
Publishing multiple SPF records beginning with v=spf1 for the same domain is invalid. Add a service by merging its required authorisation into the existing policy rather than creating a second SPF record.
What a DKIM signature proves
DKIM associates a signing domain with a message through a cryptographic signature. The signing system keeps the private key, while a receiving server retrieves the corresponding public key from DNS. The receiver then verifies the signature against the selected headers and body content identified by the signature parameters.
The signature appears in the message headers as DKIM-Signature. Its d= tag identifies the signing domain, while s= identifies the selector. A “DKIM passed” result is incomplete without the d= value because a valid signature from an unrelated domain does not provide DMARC alignment.
Why DKIM uses selectors
A selector lets a domain publish and manage multiple DKIM keys. This supports separate keys for different services and allows a new key to be introduced without immediately removing the old one.
Hypothetical example: a key using the selector mail2026 for example.com could be published at this DNS name:
mail2026._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=PUBLIC_KEY_DATA"
The p= tag contains the public key material. It is shortened here for readability and is not a usable key. The private key must not be published in DNS; it remains on the authorised system that signs outgoing messages.
For key rotation, publish the new public key first, configure the sending system to use its new selector, and retain the old record while messages carrying old signatures may still be verified. Removing the old record immediately can make those signatures unverifiable, while replacing a key under the same selector can conflict with cached DNS data.
DKIM does not encrypt a message, hide its contents or prove that the sender has good intentions. An attacker can correctly sign malicious mail using a domain they control. DKIM establishes facts about the signature, signing domain and signed content; it is not a safety verdict.
DMARC and domain alignment
DMARC relates SPF and DKIM results to the domain in the visible From address. This relationship is called alignment. The domain owner can publish a policy requesting that receivers take no special action, quarantine, or reject messages that fail DMARC.
At least one aligned authentication path must succeed: aligned SPF or aligned DKIM. Checking only for the word “pass” beside SPF or DKIM is therefore insufficient; the domain behind the successful result must also be compared with the visible sender domain.
SPF alignment versus DKIM alignment
- SPF alignment: The envelope sender domain authenticated by SPF must align with the visible
Fromdomain under DMARC’s rules. - DKIM alignment: The
d=domain in a valid DKIM signature must align with the visibleFromdomain.
DMARC uses relaxed alignment by default. Under relaxed alignment, news.example.com and example.com can align when they share the same organisational domain. Strict alignment requires an exact domain match. Relaxed mode is usually easier to deploy across subdomains; strict mode is appropriate only when an organisation intentionally requires exact separation.
DMARC records and policy options
Hypothetical example:
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:[email protected]"
This illustrative record requests no enforcement action based on DMARC failure. It also asks receivers that support aggregate reporting to send reports to the specified address. Before using a similar record, create or configure the reporting mailbox and confirm that it can handle XML reports and potentially substantial report volume.
The main policy values are:
p=none: Requests no special delivery action based on DMARC failure and is commonly used while observing traffic.p=quarantine: Asks receivers to treat failing messages as suspicious, which may include placing them in a spam folder.p=reject: Asks receivers to reject messages that fail DMARC.
The rua tag specifies where aggregate DMARC reports should be sent. When the report destination is in another domain, the destination may need the external-report authorization required by RFC 7489, section 7.1. Use the reporting service’s documented verification process; adding an arbitrary external mailbox does not ensure that reports will be delivered. These XML reports can contain source IP addresses, authentication results, policy information and message counts, but they do not provide a complete copy of every message. Receivers also differ in whether, when and how they send reports.
Do not move a domain to p=reject until legitimate senders have been identified and corrected. An invoicing application, seasonal campaign platform or externally managed service may appear only during its normal sending cycle.
How the three checks meet at the receiver
Receiver implementations differ, so the following is a logical model rather than a guaranteed execution order:
- The receiver evaluates SPF using the connecting IP address and relevant SMTP identity.
- It verifies available DKIM signatures with public keys retrieved from DNS.
- It checks whether a successful SPF or DKIM identity aligns with the visible
Fromdomain. - If DMARC fails, it considers the published policy together with its own security and delivery rules.
This creates two possible authentication paths. If a forwarding service changes the SMTP envelope, SPF alignment may fail while DKIM continues to work, provided the signed content survives. A mailing list that modifies a signed subject line, footer or body can break DKIM. Tests should therefore include the forwarding and mailing-list paths actually used by the organisation.
A DMARC pass does not guarantee inbox placement. Receivers may also consider IP and domain reputation, message content, user complaints, sending patterns and their own filtering rules. Authentication is a foundation for trustworthy handling, not immunity from spam filtering.
A low-risk deployment order
Before making changes, obtain access to the authoritative DNS zone, administrative access to each sending service and a mailbox that can receive external test messages. Record the current DNS values so they can be restored if an incorrect change disrupts mail. DNS caching also means that corrected records may not be visible everywhere immediately.
1. Inventory every system that sends mail
Include the main mailbox provider, websites, contact forms, e-commerce platforms, help desks, CRM systems, accounting software and newsletter services. For each source, record the envelope sender domain, DKIM d= value, visible sender domain and responsible service owner. The expected outcome is a list that explains every legitimate source seen in mail headers and DMARC reports.
Do not confuse a WAF protecting a web form with email authentication. Web Application Firewalls Explained: Benefits and Use Cases covers HTTP traffic and application requests. SPF, DKIM and DMARC cover domain identities in email generated by that form.
2. Build one clean SPF record
Authorise only systems that genuinely send mail. If a web server does not send email, do not add the a mechanism merely because that server appears in the domain’s A record. Document which provider requires each mechanism and check the DNS-query limit before publishing. The expected result is one valid SPF record for each applicable SMTP domain, but SPF alone will not authenticate the visible From address.
3. Enable DKIM for each sending service
Mailbox providers and third-party platforms can use separate selectors. Enter the record name and value exactly as supplied, but first check whether the DNS panel appends the zone name automatically. Entering a fully qualified name in such a panel can accidentally create selector._domainkey.example.com.example.com. Confirm the published DNS name and then inspect a message sent through that service. The expected result is a valid DKIM signature with the intended d= domain and selector.
4. Start DMARC in observation mode
For many deployments, an initial record can use p=none with a working rua mailbox or report-processing service. Collect reports long enough to include the domain’s normal sending cycle, then separate unauthorised sources from legitimate but misconfigured systems. A few quiet days may not include monthly invoices or occasional campaigns. The expected outcome is evidence about alignment without requesting quarantine or rejection.
5. Tighten the policy gradually
Once legitimate sources consistently pass through aligned SPF or DKIM, consider p=quarantine. Move to p=reject only when unexplained failures have been resolved and business owners have confirmed that important messages arrive correctly. DMARC policy is a request to receivers, and individual receivers retain discretion over final handling.
What these records do not protect
SPF, DKIM and DMARC do not stop a mailbox account from being compromised. If an attacker signs in with valid credentials and sends through an authorised mail server, SPF can pass and the server can add a valid DKIM signature. Multi-factor authentication, access controls, sending limits and monitoring for unusual volume remain necessary.
These mechanisms do not scan malicious attachments, prove that links are safe or secure mailbox logins. Email security requires separate controls for domain authentication, account security, content filtering and sending reputation. A healthy authentication result does not repair a failure in another layer.
Web forms require their own application security. Spam generated through an authorised system may legitimately pass SPF and DKIM. In that situation, investigate the abused account or application rather than changing an otherwise correct DNS record.
Four checks after deployment
Seeing records in a DNS panel does not prove that authentication works. After DNS changes are visible, send an authorised test message to an external mailbox and inspect its raw headers. This requires access to the receiving mailbox’s “show original,” “view source” or equivalent feature. The test should answer four questions:
- Does SPF pass, and which envelope domain was authenticated?
- Does DKIM pass, and do the
d=ands=values identify the expected domain and selector? - Does DMARC pass, and did that success come from SPF, DKIM or both?
- Is the visible
Fromdomain correct?
The expected outcome is an aligned SPF or DKIM pass for each legitimate sending path. One test cannot represent every provider, forwarding route or mailing list, so repeat it for each service and important delivery path. Continue monitoring aggregate DMARC reports, and repeat the checks before a new sending service goes live.
When a service is retired, remove its SPF authorisation and obsolete DKIM records once they are no longer needed. Every remaining include and selector should have a documented owner and purpose.
Frequently asked questions
Do I need SPF, DKIM and DMARC together?
For a domain that actively sends email, deploying all three provides complementary coverage. SPF identifies permitted sending sources, DKIM provides a verifiable signature, and DMARC evaluates alignment with the visible sender and publishes a failure policy. A domain that never sends mail can publish restrictive SPF and DMARC policies to state that intent; it does not need to create DKIM keys when no system signs mail.
Does p=none provide protection?
p=none helps collect reports from participating receivers and identify systems using the domain. It does not request quarantine or rejection of failing messages. It is an observation stage rather than an enforcement policy.
Should an SPF record use ~all or -all?
~all produces softfail for sources not matched by the policy, while -all produces fail. After every legitimate sender has been identified, -all states a clear non-authorisation result for unmatched sources. Switching before the inventory is complete can affect valid mail.
Will SPF, DKIM and DMARC keep messages out of spam?
No. Authentication is one requirement for dependable delivery, not a guarantee. IP and domain reputation, content, complaint rates, sending patterns and each receiver’s filters still affect placement.
Sources
- RFC Editor – RFC 7208 – SMTP identities, a single SPF policy and DNS-querying term limits.
- RFC Editor – RFC 6376, Section 1 – Introduces DKIM’s use of cryptographic signatures to associate a domain with a message.
- RFC Editor – RFC 7489, Section 6.3 – Defines the DMARC policy tag and its permitted values.
Put this guide to work
Compare the number of websites, resource requirements and who will manage the server.
Explore shared hosting options for managing your website with cPanel.