All posts

How to Add Several Email Services to One SPF Record

··4 min read

To add several email services to SPF, put all of them in one record: a single v=spf1, then each service's include: or IP range, then one ~all or -all at the end. Never publish a second SPF record for the new service. Afterwards, count the DNS lookups, because the record fails once it needs more than ten.

The second-record mistake is the common one. A new tool's setup page says "add this TXT record," someone pastes it as given, and the domain now has two SPF records. Under RFC 7208 that is a permanent error, and every SPF check on the domain fails, including for the services that were working before.

Before and after

Say a domain uses Google Workspace for staff email, Microsoft 365 for a subsidiary mailbox, and a billing system that sends from its own fixed IP. The broken version:

example.com  TXT  "v=spf1 include:_spf.google.com ~all"
example.com  TXT  "v=spf1 include:spf.protection.outlook.com -all"
example.com  TXT  "v=spf1 ip4:203.0.113.25 ~all"

The merged version:

example.com  TXT  "v=spf1 include:_spf.google.com include:spf.protection.outlook.com ip4:203.0.113.25 ~all"

One v=spf1 at the start, every mechanism in the middle, one all at the end. Mechanisms are evaluated left to right, and anything after all is ignored, so the all always goes last.

Step 1: List who actually sends as you

Write down every system that sends email with your domain in it: staff mailboxes, newsletter and marketing platforms, CRM sequences, helpdesk, invoicing, e-commerce receipts, website forms. Your DMARC aggregate reports, if you have them, show every source that used the domain.

Step 2: Find out which ones need SPF

This is the step people skip. SPF is checked against the envelope sender, the domain in the Return-Path, not the From address your reader sees (RFC 7208, section 2.4). So:

  • Your mailbox provider (Google Workspace, Microsoft 365) sends with your domain as envelope sender. It belongs in SPF.
  • A server or app you run that sends directly belongs in SPF, usually as ip4: or ip6:.
  • A marketing or transactional platform may use its own bounce domain. If so, its include in your record does nothing. What matters for DMARC is that it signs DKIM with your domain, or offers a custom return-path on a subdomain of yours, which then gets its own SPF record.

Check each platform's authentication docs and note which case applies. Removing includes that do nothing also frees lookups.

Step 3: Build the record

Use the SPF record generator to assemble the merged record from your list, or write it by hand following the pattern above. A few rules from the RFC:

  • Each TXT string is limited to 255 characters. Longer records are published as several quoted strings in one TXT record, which receivers join together.
  • Prefer ip4: and ip6: for fixed addresses. They cost no lookups.
  • Avoid ptr. RFC 7208 says it should not be used, and it costs a lookup.

Step 4: Count the lookups

RFC 7208 section 4.6.4 caps an SPF evaluation at ten DNS-querying terms. include, a, mx, ptr, exists and redirect count, and so do the includes inside your includes. ip4, ip6 and all do not. It also allows at most two "void" lookups that return nothing.

Paste the merged record's domain into the SPF lookup counter to see the full include tree and which service costs the most. If you are over:

  1. Remove services that no longer send, or that do not need SPF (step 2).
  2. Move a sending stream to a subdomain, such as mail.example.com, with its own record and its own ten lookups.
  3. As a last resort, flatten the record with the SPF flattener, which replaces includes with the IP ranges behind them. Flattened records go stale when a provider changes its IPs, so recheck them regularly.

Our post on too many SPF DNS lookups goes deeper on each option.

Step 5: Replace, then test

Edit the existing record rather than adding a new one, delete any leftovers, and wait for the old TTL to expire. Then send a test from each service to a mailbox you control and check that spf=pass appears in the Authentication-Results header for the ones that use your envelope domain. Our study of SPF record mistakes lists the other errors worth checking for while you are in there.

Then look after the list

A valid SPF record keeps your mail from being treated as spoofed. It does nothing for messages addressed to mailboxes that no longer exist, and those bounces count against the same domain.

Sign in with Google and your first 100 email checks are free, no card. Paid plans for bigger lists are monthly; see pricing.

Common questions

Can I have two SPF records on one domain?

No. RFC 7208 says a domain must not publish more than one SPF record, and a receiver that finds two returns permerror, which is treated as a failed check. Merge them into one record.

How do I combine two SPF records?

Keep one v=spf1 at the start, copy every include, ip4 and ip6 mechanism from both records into it, remove duplicates, and end with a single all mechanism. Then delete the second record.

Do I need to add my newsletter tool to SPF?

Only if it sends with your domain in the envelope sender (the Return-Path). Many email platforms use their own bounce domain by default, so SPF is checked against their domain, not yours, and your include changes nothing. Check the platform's authentication docs; some offer a custom return-path you can point at your domain.

Should my SPF record end in ~all or -all?

Either works with DMARC. ~all (softfail) tells receivers that unlisted senders are suspicious; -all (fail) says they are not authorised. Once DMARC is enforcing, the DMARC policy decides what happens to failing mail, so many domains keep ~all to avoid edge-case rejections.

What happens if my SPF record goes over 10 lookups?

The SPF check returns permerror, and receivers treat it as a failure. Remove includes you no longer use, replace includes for fixed IPs with ip4 or ip6, or move some senders to a subdomain with its own record.

Check your list before you send

Real mailbox checks over SMTP, and nothing is sent to the address. Sign in with Google and your first 100 email checks are free, no card. Plans for bigger lists are on the pricing page.

5.0 on G2