Email Security

SPF and DKIM Pass, but DMARC Fails: How to Diagnose Email Alignment

SPF and DKIM pass but DMARC fails? Learn how to check email alignment, inspect message headers and fix custom DKIM and Return-Path settings.

Your email provider says SPF and DKIM are working. Yet a message sent from your website fails DMARC.

That can happen without either authentication check being broken. SPF and DKIM may successfully authenticate domains belonging to your email provider, while neither domain aligns with the address your recipient sees.

Diagnosing the problem starts with identifying which domains passed authentication.

Why authentication alone is not enough

An email has several sender identities that serve different purposes:

Identity Where to find it Purpose
Visible From address From: header Identifies the sender shown to the recipient
Envelope sender SMTP MAIL FROM, usually reflected in the delivered Return-Path: Receives delivery failures and supplies the domain checked by SPF
DKIM signing domain d= in a DKIM-Signature: header Identifies the domain taking responsibility through a cryptographic signature

DMARC connects authentication to the visible From domain. A message needs at least one successful, aligned authentication result: SPF or DKIM. Both are not required for an individual message to pass DMARC. Microsoft’s DMARC documentation

A worked example: two passes, one failure

Imagine your website sends invoices using these identities:

From: Accounts <[email protected]>
Return-Path: <[email protected]>

The provider signs the message with the DKIM domain example.net.

The receiving server might record these simplified results:

Authentication-Results: mx.receiver.example;
    spf=pass smtp.mailfrom=mailer.example.net;
    dkim=pass header.d=example.net;
    dmarc=fail header.from=example.com

SPF passes for mailer.example.net. DKIM passes for example.net. Neither authenticates an aligned domain for the visible sender, example.com.

The provider has authenticated its own infrastructure successfully, but that does not establish the relationship DMARC requires with your From domain.

Step 1: inspect a real message

Send a test through the affected application and open the received message’s original source or full headers.

Record:

  • The domain in From:.
  • The smtp.mailfrom domain beside the SPF result.
  • The header.d domain beside each DKIM result.
  • The DMARC result and its header.from value.

Use the authentication results added by your receiving mail service. Messages can contain multiple Authentication-Results headers, and an attacker can insert misleading ones. The header’s presence alone does not make it trustworthy. Authentication-Results specification

Test the actual sending route. A successful message from your staff mailbox tells you little about invoices sent through a billing platform.

Step 2: check relaxed and strict alignment

DMARC supports two alignment modes:

  • Relaxed: the authenticated domain and From domain share the same organisational domain.
  • Strict: the domains match exactly.

The DMARC record controls these separately through aspf for SPF and adkim for DKIM. Both default to relaxed alignment.

For a From domain of example.com, assuming the subdomains below share that organisational domain:

Authenticated domain Relaxed alignment Strict alignment
example.com Yes Yes
bounce.example.com Yes No
mail.example.com Yes No
example.net No No

An aligned domain must also pass its authentication check. Matching names cannot rescue a failed signature. If a message has several DKIM signatures, one passing, aligned signature is sufficient. DMARC specification, alignment rules

Step 3: configure DKIM for your domain

Look for your provider’s domain authentication or custom DKIM settings.

For the invoice example, the desired outcome is a valid signature with:

d=example.com

Follow the provider’s instructions for publishing its DNS records and enabling signing. Publishing records is only part of the setup: confirm that newly sent messages actually carry the expected signature and that the receiver validates it.

Provider settings can vary between sending identities or regions. Amazon SES, for example, documents regional setup requirements and identity-specific overrides. Amazon SES DKIM documentation

With passing DKIM aligned to example.com, the example message can pass DMARC even if its SPF-authenticated domain remains mailer.example.net.

Step 4: configure a custom envelope sender where supported

A provider may offer a custom MAIL FROM, bounce domain or Return-Path domain.

For example:

From: Accounts <[email protected]>
Return-Path: <[email protected]>

This can provide SPF alignment under relaxed mode, provided SPF passes for bounce.example.com. It would not provide strict SPF alignment with example.com.

Follow the provider’s exact DNS requirements. Amazon SES requires SPF and MX records for its custom MAIL FROM domain and can, depending on configuration, fall back to its default domain when the custom setup fails. Check the domain used on delivered messages, not just the saved setting. Amazon SES custom MAIL FROM documentation

Adding a provider to the SPF record for example.com does not fix messages whose envelope sender still uses mailer.example.net. Changing SPF authorisation does not change the sender identity being checked.

Step 5: retest every sending service

Build a small inventory before declaring the issue resolved:

Sending service Test message What to verify
Website application Password reset Expected From domain and aligned authentication
Billing platform Invoice Custom domain configuration is active
Marketing platform Campaign preview Production sending identity is used
Support system Ticket response Replies use an authenticated, aligned domain

Retest after the DNS changes become visible and the provider confirms activation. Keep a copy of the resulting headers so you can compare future failures against a known working message.

Enable DMARC aggregate reporting to monitor other sending sources. Google recommends reports to help identify mail using your domain, including potential impersonation. Google’s email sender guidelines

Changing the policy does not repair alignment

Switching to p=none does not turn a DMARC failure into a pass. It changes your requested handling policy for failures; receivers still apply their own filtering decisions. Microsoft’s DMARC policy guidance

Likewise, passing DMARC does not guarantee inbox placement. Gmail also considers factors such as spam complaints, sending infrastructure and message formatting. Google’s sender requirements

When both SPF and DKIM show a pass, compare their authenticated domains with the visible From domain before changing DNS. That comparison tells you whether to investigate authentication itself or configure the missing alignment.