SPF, DKIM and DMARC when you send through several providers

By Sendviser · Updated · 7 min read

Many large senders use more than one email provider, and every one of them has to pass SPF, DKIM and DMARC as your domain. Set up carelessly, the records collide: SPF exceeds its lookup limit, and DKIM ends up signed with a provider’s domain instead of yours. This guide shows a layout that keeps every provider aligned and every record within its limits.

How DMARC alignment works

DMARC checks the domain in the visible From header against two authenticated identifiers:

IdentifierWhere it comes fromWhat it must match
SPF domainThe envelope sender (SMTP MAIL FROM), which the receiving server records as Return-PathThe From domain
DKIM domainThe d= tag of a DKIM signature that verifiesThe From domain

A message passes DMARC when at least one of the two both passes and aligns. You do not need both, although having both gives you a fallback.

Alignment has two modes, set by aspf for SPF and adkim for DKIM. Relaxed is the default: the two domains must share the same organisational domain, so bounce.example.com aligns with example.com. Strict requires an exact match. Keep relaxed unless you have a specific reason not to.

The May 2026 revision of DMARC, RFC 9989, obsoletes RFC 7489. Receivers now find the organisational domain with a DNS tree walk instead of the Public Suffix List, but the model is the same. The RFC states plainly that DMARC uses only the MAIL FROM identity for SPF, never the HELO name.

Here is a message from a provider that is set up correctly:

Return-Path: <[email protected]>
From: Example News <[email protected]>
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=pa1; ...
Authentication-Results: mx.example.net;
    spf=pass smtp.mailfrom=pa.example.com;
    dkim=pass header.d=example.com header.s=pa1;
    dmarc=pass header.from=example.com

The common failure looks almost the same. SPF passes for the provider’s own bounce domain and DKIM passes for the provider’s own signing domain. Both checks pass, neither aligns, and DMARC fails.

One DKIM selector per provider

A DKIM public key lives at <selector>._domainkey.<domain>. The selector is just a label, so one domain can publish as many keys as it needs. Give every provider its own selector and its own key pair. Never copy one private key to several providers: M3AAWG advises against sharing the same DKIM keys across several entities, and a leak at one provider would then compromise all of them.

There are two ways to publish a provider’s key. You can publish the public key yourself as a TXT record. Or you can publish a CNAME to a key the provider hosts, which lets the provider rotate the key without asking you to change DNS.

; Key you generated and publish yourself
s1._domainkey.example.com.    IN TXT    ( "v=DKIM1; k=rsa; "
                                          "p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
                                          "...IDAQAB" )

; Keys hosted by providers, delegated with CNAME
pm._domainkey.example.com.    IN CNAME  pm.dkim.provider-a.example.net.
ses1._domainkey.example.com.  IN CNAME  ses1.dkim.provider-b.example.net.

The selector names here are illustrations. Each provider tells you which names and targets to publish.

What matters for alignment is the d= tag. Every provider must sign with d=example.com, or a subdomain of it, not with its own domain. Some providers also add a second signature with their own domain. That does no harm, as long as one valid signature carries yours.

Key length and rotation

Use 2048-bit RSA keys. RFC 8301 requires signers to use at least 1024 bits and recommends at least 2048, and it retires rsa-sha1 entirely. A 2048-bit public key is longer than the 255 characters one DNS text string can hold, so publish it as several strings in one TXT record, as above. Verifiers join the strings back together. Check that your DNS servers return the larger response cleanly over EDNS0 or TCP.

Rotate keys per selector. The M3AAWG DKIM Key Rotation Best Common Practices recommend rotating at least every six months. A clean rotation for a key you hold:

  1. Publish the new key under a new selector name.
  2. Wait for DNS to propagate, then switch the provider to sign with the new selector.
  3. Keep the old key published while mail already in queues is delivered and verified. M3AAWG suggests at least seven days and up to 30.
  4. Revoke the old key by republishing its selector with an empty p= value. Do not delete the record.

Do not reuse selector names. M3AAWG notes that a reused name makes old messages fail any later re-verification, and causes problems for receivers holding a stale cached copy of the old key. Because every provider has its own selector, you can rotate one without touching the others.

SPF and the ten-lookup limit

SPF is checked against the MAIL FROM domain. RFC 7208, section 4.6.4, limits evaluation to 10 terms that cause DNS lookups: include, a, mx, ptr, exists and the redirect modifier. The ip4, ip6 and all mechanisms are free. Nested includes count towards the same total. Go over 10 and the result is permerror. DMARC treats that as SPF not passing.

Providers’ SPF records often include further records of their own. Stacking every provider on the root domain soon breaks the limit:

; Do not do this
example.com.  IN TXT  "v=spf1 include:_spf.provider-a.example.net include:spf.provider-b.example.net include:mail.provider-c.example.net include:_spf.crm.example.org mx a ~all"

Each include costs one lookup plus every lookup inside it. A record like this can fail for every message, and it fails without warning when a provider adds a nested include.

Two more points catch people out. A name may publish only one SPF record; two records give permerror. Replacing includes with copied IP ranges, often called flattening, removes lookups but goes stale silently whenever a provider changes its addresses.

Return-path subdomains

The clean fix is to stop putting provider SPF on the root domain at all. Ask each provider to use a custom return-path (bounce) domain under your domain. Each one gets its own subdomain, and the SPF record for that provider lives there.

; Root domain: only what really uses example.com as MAIL FROM
example.com.        IN TXT    "v=spf1 include:_spf.corp-mail.example.net ~all"

; Provider A: subdomain delegated with a CNAME the provider supplies
pa.example.com.     IN CNAME  bounces.provider-a.example.net.

; Provider B: MX and SPF published on the subdomain
pb.example.com.     IN MX     10 feedback.provider-b.example.net.
pb.example.com.     IN TXT    "v=spf1 include:spf.provider-b.example.net ~all"

This layout does three things:

  • Alignment. Under relaxed alignment, pa.example.com aligns with a From address at example.com, so SPF counts towards DMARC.
  • Bounce handling. The subdomain’s MX, or the CNAME target, still points at the provider, so bounces reach the system that processes them.
  • Lookup budget. Each MAIL FROM domain is evaluated separately with its own limit of 10. One provider’s record cannot push another over the limit.

Whether you end with ~all or -all does not change DMARC. DMARC only asks whether SPF passed.

Why DKIM survives forwarding and SPF does not

When a recipient forwards mail, for example from a university alias to a personal mailbox, the forwarding server connects from its own IP address. If it keeps your MAIL FROM, SPF fails, because your record does not list the forwarder. If it rewrites MAIL FROM to its own domain, SPF can pass, but for the forwarder’s domain, so it no longer aligns. RFC 7960 describes these cases in detail.

A DKIM signature travels inside the message. If the forwarder does not change the signed headers or the body, the signature still verifies and still aligns. Mailing lists are the main exception: a subject tag or a footer invalidates the signature.

So treat DKIM as your primary alignment and SPF as the backup. RFC 9989 makes the same point for enforcement: a domain that publishes p=reject must not rely on SPF alone and must apply valid DKIM signatures. Every message, from every provider, should carry an aligned signature.

One identity on every route

Mailbox providers attach reputation to domains as well as to IP addresses. Google’s sender guidelines say that Gmail tracks volume, feedback and limits per domain and per IP. If a provider signs with its own domain, part of the reputation that mail earns goes to a domain you do not control, and DMARC on that route depends on SPF alone.

Keep one identity across all of them: the same From domain and the same DKIM d= whichever provider carries the message. Separate your mail by stream, not by provider. You might sign marketing with d=mail.example.com and receipts with d=notify.example.com. Each stream keeps that domain on every provider it uses.

One identity also means nothing is hidden. Complaints, blocks and listings follow the domain to every provider that carries it, and that is the point: a second provider is never a way around a reputation the domain has earned.

When you add a provider, check five things before it carries production traffic:

  1. Its own DKIM selector is published and verifies.
  2. It signs with your d=, not its own.
  3. Its return-path uses its own subdomain of yours, with SPF on that subdomain.
  4. No SPF record anywhere in the chain exceeds 10 lookups.
  5. A test message shows dmarc=pass in Authentication-Results, and your DMARC aggregate reports show the new source as aligned.

For why senders use several providers in the first place, see Why serious senders use more than one provider. For moving the policy to enforcement once every source aligns, see Moving DMARC from p=none to p=reject.

How Sendviser handles this

Sendviser keeps your From domain and DKIM signing domain the same on every provider it routes through, so alignment holds whichever route carries the message.

Talk to us.

[email protected]