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.
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:
| Mode | Tag Value | Matching Rule |
|---|---|---|
| Relaxed | aspf=r / adkim=r | Subdomain match allowed (e.g., mail.example.com โ example.com) |
| Strict | aspf=s / adkim=s | Exact 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=noneinitially 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.