dmarc=fail even though SPF or DKIM passes: alignment

DMARC needs SPF or DKIM to pass for the domain in the From address. Why a pass for your email provider's domain isn't enough.

Authentication-Results: mx.google.com;
       dkim=pass header.i=@sendgrid.info;
       spf=pass smtp.mailfrom=bounces+123@em1234.sendgrid.net;
       dmarc=fail (p=QUARANTINE) header.from=example.com

Both SPF and DKIM passed, and DMARC still failed. That's because DMARC doesn't only ask whether they passed, but for which domain. At least one of them has to pass for the domain in the From address. That match is called alignment.

How alignment works

  • SPF aligns when the envelope sender (Return-Path, shown as smtp.mailfrom) has the same domain as the From address.
  • DKIM aligns when the signing domain (d=, shown as header.d or header.i) has the same domain as the From address.
  • In relaxed mode (the default), subdomains count: bounce.example.com aligns with example.com. In strict mode (aspf=s, adkim=s) they must match exactly.

In the example, SPF passed for sendgrid.net and DKIM passed for sendgrid.info. Neither is example.com, so DMARC fails. This is the typical result of connecting an email platform without completing its "domain authentication" step.

How to fix it

  1. Set up DKIM with your own domain in the sending service. Look for "domain authentication", "sender authentication" or "custom DKIM". You publish a few CNAME records, and the service signs with d=example.com. This is the fix that matters most, because DKIM also survives forwarding.
  2. Optionally, set a custom return-path (for example bounce.example.com) so SPF aligns too.
  3. Use relaxed alignment unless you have a specific reason for strict. Strict mode breaks every service that uses a subdomain of yours.