# DMARC Identifier Alignment Explained: SPF Pass + DKIM Pass Can Still Fail DMARC!

> Why emails with spf=pass and dkim=pass still bounce with dmarc=fail when Return-Path or DKIM d= domains don't align with From:, plus aspf=r/s and adkim=r/s rules.

- **Canonical URL**: https://opslint.dev/dmarc/identifier-alignment-spf-dkim-relaxed-vs-strict/
- **Category**: `DMARC`
- **Interactive Workbench**: [Open in Live Workbench](https://opslint.dev/dmarc/#domain=stripe.com)
- **Normative Specifications**: `RFC 7489 §3.1 (Identifier Alignment: Core DMARC Requirement)`, `RFC 7489 §3.1.1 (SPF Alignment: MAIL FROM vs RFC5322.From)`, `RFC 7489 §3.1.2 (DKIM Alignment: d= Tag vs RFC5322.From)`

## Incident Symptom & Root Cause

**Production Symptom**: Inspecting a bounced message's Authentication-Results header shows BOTH spf=pass AND dkim=pass—yet right below them sits dmarc=fail (p=reject dis=reject)! Engineers stare at two green 'pass' results unable to figure out why DMARC rejected the email.

**Protocol / Engine Root Cause**: Raw SPF Pass and DKIM Pass only prove the sender authorized the envelope/signing domain (such as sendgrid.net or amazonses.com)! DMARC requires IDENTIFIER ALIGNMENT: the authenticated SPF Return-Path domain OR at least one valid DKIM d= signing domain MUST match the visible RFC 5322 'From:' header domain (exactly under Strict 's' mode, or sharing the same PSL organizational root under default Relaxed 'r' mode)!

## Remediation Diff (Broken vs Verified Fix)

### Unaligned Cloud ESP Default Config (spf=pass + dkim=pass, YET dmarc=fail!)

```text
# Visible Header seen by human recipient:
From: Billing <billing@example.com>

# Default unconfigured ESP SMTP Envelope & Shared DKIM Signature:
Return-Path: <0100018f-uuid@us-west-2.amazonses.com>   # spf=pass (amazonses.com != example.com!)
DKIM-Signature: v=1; a=rsa-sha256; d=amazonses.com; ... # dkim=pass (amazonses.com != example.com!)

# Result: SPF Aligned = FALSE, DKIM Aligned = FALSE -> DMARC = FAIL (Rejected under p=reject!)
```

### Custom DKIM Domain + Custom Return-Path Subdomain (Both Aligned!)

```text
# Visible Header:
From: Billing <billing@example.com>

# 1. Custom MAIL FROM / Return-Path subdomain on example.com (Passes Relaxed aspf=r!):
Return-Path: <0100018f-uuid@bounces.example.com>

# 2. Custom 2048-bit DKIM CNAMEs signing directly with d=example.com (Passes BOTH adkim=r & adkim=s!):
DKIM-Signature: v=1; a=rsa-sha256; s=pm2026; d=example.com; ...

# _dmarc.example.com (keep default relaxed alignment aspf=r; adkim=r unless strict is verified!):
# "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"
```

## Engineering Deep Dive

Without Identifier Alignment, SPF and DKIM would provide zero protection against display-From spoofing! Imagine an attacker registers evil-mailer.net, sets up clean SPF and DKIM for evil-mailer.net, and sends an email with envelope MAIL FROM:<bot@evil-mailer.net>, DKIM-Signature: d=evil-mailer.net, and visible header From: CEO <ceo@yourcompany.com>. Both raw spf=pass (evil-mailer.net) and dkim=pass (evil-mailer.net) succeed! DMARC closes that loophole by comparing the authenticated domain against RFC5322.From (yourcompany.com).

DMARC passes as soon as EITHER aligned SPF passes OR aligned DKIM passes (only 1 of the 2 is required by RFC 7489 §4.2, though configuring both gives resilience!). Compare Relaxed (r, the default when aspf/adkim are omitted) against Strict (s): under Relaxed (r), any subdomain sharing the same Public Suffix List organizational domain aligns (bounces.example.com aligns with From: @example.com, and mail.uk.example.com aligns with From: @billing.example.com!). Under Strict (s), the strings must match label-for-label (bounces.example.com FAILS strict alignment against From: @example.com!).

That single distinction explains why setting aspf=s on a modern SaaS company's DMARC record almost always breaks SPF alignment for transactional ESPs! Amazon SES, Postmark, Mailgun, SendGrid, and HubSpot all require a dedicated subdomain (like em.example.com or pm-bounces.example.com) for custom Return-Path bounce routing because your root example.com MX points to Google Workspace or Microsoft 365! Keep aspf=r (relaxed) so bounce subdomains align cleanly with @example.com, and verify custom DKIM (d=example.com) on every ESP.

## DMARC Alignment Truth Table (Visible From: user@example.com)

| Case / Engine | Protocol Behavior | Production Remediation |
| :--- | :--- | :--- |
| **Return-Path: @sendgrid.net / d=sendgrid.net** (`#align-esp-default-domain`) | Different organizational domain; fails BOTH Relaxed (r) and Strict (s) alignment! | Complete 'Domain Authentication' (custom DKIM CNAMEs + custom Return-Path) in ESP settings. |
| **Return-Path: @bounces.example.com** (`#align-bounce-subdomain`) | PASSES Relaxed (aspf=r) alignment; FAILS Strict (aspf=s) alignment against @example.com! | Keep default aspf=r so custom bounce subdomains pass SPF alignment. |
| **DKIM-Signature: d=example.com** (`#align-exact-apex-dkim`) | Exact organizational & hostname match; PASSES both Relaxed (adkim=r) and Strict (adkim=s)! | Configure 2048-bit custom DKIM signing on every authorized email platform. |
| **DSN / Auto-reply with empty MAIL FROM:<>** (`#align-empty-mail-from-helo`) | RFC 7489 §3.1.1 checks SPF alignment against the SMTP HELO/EHLO hostname! | Name outbound MTAs under your domain (smtp1.example.com) so HELO aligns under aspf=r. |

## Frequently Asked Engineering Questions

### Does DMARC require BOTH SPF alignment AND DKIM alignment to pass?

No! Per RFC 7489 §4.2, DMARC evaluates as PASS if (SPF=Pass AND SPF-Aligned) OR (DKIM=Pass AND DKIM-Aligned). However, configuring BOTH on every stream ensures forwarded mail (where SPF breaks) passes via DKIM, while messages whose body got re-wrapped by a footer gateway (where DKIM breaks) can still pass via SPF!

### Wait: if Amazon SES sends with default Return-Path @amazonses.com BUT signs custom DKIM d=example.com, does DMARC pass?

Yes! Because DKIM (d=example.com) passes AND aligns with From: @example.com, DMARC passes even when Return-Path stays on @amazonses.com! Setting up SES Custom MAIL FROM (bounces.example.com) in addition gives you dual SPF+DKIM alignment.

### Does DKIM 'i=' (Agent or User Identifier) affect DMARC alignment, or only 'd='?

RFC 7489 §3.1.2 aligns strictly against the DKIM 'd=' (Signing Domain Identifier) tag, NOT 'i='.

## Related Problem-Cluster Guides

- [Subdomain SPF & Return-Path Architecture: Isolate Transactional, Marketing, and Corporate Mail](https://opslint.dev/spf/subdomain-spf-delegation-transactional-vs-marketing/) — Design clean DNS authentication boundaries across corporate (@example.com), transactional (@notify.example.com), and marketing (@news.example.com) streams.
- [DMARC Organizational Domain Discovery, Public Suffix List (PSL) Fallback, and sp= Tag](https://opslint.dev/dmarc/organizational-domain-public-suffix-fallback-sp-tag/) — How RFC 7489 §3.2 uses the Mozilla Public Suffix List (e.g. .co.uk, .com.au, .github.io) to find organizational _dmarc policies and apply sp= subdomain rules.
- [Why Email Forwarding & Mailing Lists Break SPF/DKIM under DMARC p=reject (SRS, DKIM & ARC)](https://opslint.dev/dmarc/mailing-lists-forwarding-arc-spf-breakage/) — Understand how auto-forwarding breaks SPF and how mailing lists break DKIM signatures under DMARC p=reject, plus SRS, relaxed DKIM canonicalization, and RFC 8617 ARC.
- [Gmail, Yahoo & Microsoft Bulk Sender Requirements (SPF + DKIM + DMARC + RFC 8058 One-Click)](https://opslint.dev/dmarc/gmail-yahoo-bulk-sender-authentication-requirements/) — Meet mandatory Google, Yahoo, and Outlook bulk sender rules (>=5,000/day): dual SPF+DKIM alignment, DMARC, FCrDNS PTR, <0.3% spam rate, and RFC 8058 List-Unsubscribe-Post.
