FIELD NOTES

Email Authentication Alignment Explained: SPF, DKIM & DMARC

Compare the visible From domain with SPF and DKIM identities to understand why an authenticated message can still fail DMARC.

SPF or DKIM: Authentication โ†’ From domain: Alignment check โ†’ DMARC policy: none / quarantine / reject
DMARC passes when SPF or DKIM both passes and aligns with the visible From domain. The published policy guides handling of failures.

The named scenario below is a worked example for learning, not a verified incident report. Provider settings and outcomes vary.

DMARC Alignment Check Flow

From: user@example.com

Return-Path domain

d= signing domain

Domains must match

DMARC passes

DMARC fails

๐ŸŽฏ Illustrative example: Ishaan's Emails Fail DMARC Despite Passing SPF

Ishaan's emails pass SPF and DKIM individually, but DMARC still fails. The problem is alignment:

From header: ishaan@company.com

This is what recipients see โ€” the visible 'From' address in the email.

Return-Path: bounce@sendgrid.net

SendGrid uses its own bounce address. SPF checks pass for sendgrid.net domain.

SPF passes for sendgrid.net

SPF check validates that SendGrid's IP is allowed to send for sendgrid.net. SPF passes.

But DMARC alignment fails!

DMARC requires From domain (company.com) to MATCH SPF domain (sendgrid.net). They don't match = alignment failure.

Fix: Configure custom Return-Path

Sets Return-Path to bounce@company.com in SendGrid. Now SPF domain = From domain = company.com.

DMARC passes with alignment

SPF domain matches From domain. DMARC alignment passes. Emails no longer fail DMARC.

Alignment fixed: Return-Path domain matches From domain โ†’ DMARC passes.

SPF pass โ‰  DMARC pass. DMARC requires the authenticated domain to MATCH the From domain.

What is Email Authentication Alignment?

Alignment is the DMARC concept that connects the domain in the visible From: header to the domains used in SPF and DKIM authentication.

For DMARC to pass, at least one of SPF or DKIM must both:

  • Pass its own authentication check
  • AND align with the From header domain

How SPF Alignment Works

SPF alignment compares the Return-Path (envelope sender) domain with the From header domain.

โœ… SPF Aligned (Relaxed):

user@example.com
bounce@mail.example.com

โŒ SPF Not Aligned:

user@example.com
bounce@sendgrid.net

How DKIM Alignment Works

DKIM alignment compares the d= domain in the DKIM signature with the From header domain.

โœ… DKIM Aligned:

user@example.com
example.com

โŒ DKIM Not Aligned:

user@example.com
sendgrid.net

Strict vs Relaxed Alignment

DMARC records specify alignment mode using aspf (SPF) and adkim (DKIM) tags:

ModeTag ValueMatching Rule
Relaxedaspf=r / adkim=rSubdomain match allowed (e.g., mail.example.com โ†” example.com)
Strictaspf=s / adkim=sExact domain match required

Default: If not specified, DMARC uses relaxed alignment for both SPF and DKIM. Most organizations should use relaxed mode unless they have a specific security reason for strict.

Common Alignment Failures & Fixes

Third-Party Email Services

Services like SendGrid, Mailgun, or Amazon SES send on your behalf using their own domains by default.

Fix:

  • โ€ข Set up a custom Return-Path subdomain (e.g., em.example.com) for SPF alignment
  • โ€ข Configure custom DKIM signing with d=example.com for DKIM alignment
  • โ€ข See: DKIM Setup Guide

Email Forwarding

When emails are forwarded, the forwarder changes the envelope sender (breaking SPF alignment) and may modify headers (breaking DKIM signatures).

Fix:

  • โ€ข Ensure DKIM is set up โ€” it survives forwarding better than SPF
  • โ€ข Use p=none initially to monitor without rejecting
  • โ€ข Look into ARC (Authenticated Received Chain) for forwarding chains

Multiple Sending Sources

Using multiple email providers (marketing tool + transactional + helpdesk) each needs proper alignment.

Fix:

  • โ€ข Configure custom DKIM for each provider
  • โ€ข Include all providers in your SPF record
  • โ€ข Use DMARC reports to identify unaligned sources

DMARC Record with Alignment Settings

v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com; aspf=r; adkim=r; pct=100
aspf=r
adkim=r
p=quarantine
pct=100

Frequently Asked Questions

What is DMARC alignment?

DMARC alignment means the domain in the From header must match the domain used in SPF (Return-Path) or DKIM (d= signing domain). At least one must align for DMARC to pass.

What is the difference between strict and relaxed alignment?

Relaxed allows subdomain matches (e.g., mail.example.com aligns with example.com). Strict requires an exact domain match. Relaxed is the default and recommended for most setups.

Why does DMARC fail even when SPF and DKIM pass?

Because alignment also matters. SPF may pass for sendgrid.net but the From header uses example.com โ€” that's an alignment failure. You need to configure custom domains with your email provider.

Do I need both SPF and DKIM to align?

No. DMARC requires only one of SPF or DKIM to both pass and align. However, configuring both provides redundancy โ€” if one breaks (e.g., during forwarding), the other can still pass.