Blazalek.com

How to add a sender to an SPF record (and retire an old one)

An SPF change, whether adding a sender or retiring an old one, is done when three conditions are met: your envelope domain has a single valid record, existing senders still pass, and the new (or retired) sender has the exact permissions planned.

By

On this page

An SPF change, whether adding a sender or retiring an old one, is done when three conditions are met: your envelope domain has a single valid record, existing senders still pass, and the new (or retired) sender has the exact permissions planned. Plan how you will collect that evidence before you edit DNS. This procedure covers routine maintenance; if SPF is already failing, the SPF failure runbook is the place to start.

Which domain does the SPF change have to target?

Establish the SMTP MAIL FROM domain and sending IP from your provider’s configuration and real message headers, because the visible From address alone does not identify the domain your SPF change has to target; RFC 7208 defines the actual inputs under SPF evaluation inputs. Receiving servers can also check HELO, and when the reverse path is null, the MAIL FROM identity is postmaster at the HELO domain (null-path MAIL FROM identity).

Confirm DNS ownership and the provider’s exact architecture. Editing your root apex domain does not authorize a separate envelope subdomain, and a vendor sending from its own envelope domain may need no SPF edit on your visible From domain at all (SPF policy placement).

Before moving forward, identify the service owner and every approved application relying on that policy; the sender inventory establishes that baseline. Copy your current TXT record and its TTL so you have a quick rollback reference. If the envelope identity, the owner, or the provider instructions are unclear, stop here.

Check the whole replacement policy, including the ten-lookup limit

Replace the existing SPF policy rather than adding a second one; unrelated TXT records can stay. Publishing more than one SPF TXT record triggers a permerror, while several quoted strings within a single TXT record join without spaces and count as one policy. Review both record selection and TXT string handling.

Keep existing mechanisms and your current all qualifier unchanged while making this edit. Place the new mechanism before all, since anything after it is ignored. If the record uses redirect, review it first; any all mechanism overrides redirect. Validate the replacement syntax against the SPF evaluation and all semantics rules. If you need details on qualifiers, the guide’s SPF mechanisms and qualifiers reference outlines them.

Follow every dependency the evaluation reaches, including nested include statements. The limit is ten DNS lookups across include, a, mx, ptr, exists, and redirect; an 11th triggers a permerror. The initial TXT fetch and mechanisms like ip4, ip6, and all don’t count toward this budget. Check both passing senders and the longest nonmatching path; mx and ptr carry additional query limits (DNS lookup limits).

Staying under ten lookups does not prove validity by itself. An include target without a valid SPF policy triggers permerror under the include results rules, and a reached DNS timeout or server error can produce temperror (DNS errors).

Empty answers and NXDOMAIN count as void lookups. Implementations should limit them to two; the limit may be configurable, with two as the recommended default, and exceeding the implemented limit produces permerror (DNS lookup limits).

If the policy exceeds the lookup budget, remove obsolete services or check whether the provider offers direct IP ranges. Maintaining static IP ranges requires an ongoing inventory and an owner; RFC 7208 discusses this in SPF maintenance considerations, and the guide covers tradeoffs in flattening to stay under the lookup limit.

Worked example: two includes can cost five terms

This walkthrough uses reserved documentation names and addresses. No DNS was queried and no messages were sent. Every displayed name has exactly one valid SPF TXT record, with no hidden dependencies, void answers or DNS errors, and every case uses a non-null MAIL FROM at return.example.org.

Before tickets are added, the policy is:

return.example.org. TXT "v=spf1 ip4:192.0.2.44 include:_spf.billing.example.net -all"

The replacement, together with every policy it references, is:

return.example.org. TXT "v=spf1 ip4:192.0.2.44 include:_spf.billing.example.net include:_spf.tickets.example.com -all"
_spf.billing.example.net. TXT "v=spf1 include:_spf.billing-eu.example.net include:_spf.billing-us.example.net -all"
_spf.billing-eu.example.net. TXT "v=spf1 ip4:198.51.100.0/26 -all"
_spf.billing-us.example.net. TXT "v=spf1 ip4:198.51.100.64/26 -all"
_spf.tickets.example.com. TXT "v=spf1 include:_spf.ticket-pool.example.com -all"
_spf.ticket-pool.example.com. TXT "v=spf1 ip4:203.0.113.0/27 -all"

For the ticket IP 203.0.113.7, billing costs three terms: its outer include, then EU, then US. Neither billing range matches. A child’s -all does not fail the parent; the parent moves on to tickets, which costs two more terms and matches. The total is 3 + 2 = 5. An unlisted sending IP also walks all five lookups before hitting the parent record’s -all and failing. These are results derived under the include evaluation rules.

Each cell shows the expected SPF result and the number of counted terms:

Test IP / ClientBefore additionAfter additionAfter billing retirement
192.0.2.44 (retained relay)pass; 0pass; 0pass; 0
198.51.100.10 (billing EU)pass; 2pass; 2fail; 2
198.51.100.80 (billing US)pass; 3pass; 3fail; 2
203.0.113.7 (tickets)fail; 3pass; 5pass; 2
203.0.113.200 (nonmatching control)fail; 3fail; 5fail; 2

Once billing is decommissioned and its queued traffic is accounted for, the replacement becomes v=spf1 ip4:192.0.2.44 include:_spf.tickets.example.com -all, and the longest path falls from five terms to two. These ranges do not overlap; real provider authorizations may. And the provider may change its policy later, so today’s dependency count can change as well.

What to verify after you publish, and when to retire a sender

For an addition, configure the provider and domain settings before touching DNS. Validate the proposed policy across all active paths, publish the change at the authoritative DNS provider, and verify authoritative nameservers and recursive resolvers. Cached answers linger, and newly published hostnames can encounter negative caching. Track TTLs and observed replies rather than assuming instant refresh (DNS cache lifetime, negative caching).

Send representative test messages before enabling production volume. Inspect the Authentication-Results header from a receiving system you trust, checking that SPF passes for the expected smtp.mailfrom, and retain reliable IP and HELO evidence where you need it; RFC 8601 details when an authentication result can be trusted. Confirm that continuing and newly approved senders pass for the intended identity, and cover the relevant regions, IPv6 and failover paths, because one sample cannot establish all of them.

Evaluate DMARC separately. DMARC’s SPF path requires MAIL FROM alignment with the visible From domain, so an SPF pass on an unrelated provider envelope proves nothing about the owner you edited (DMARC pass condition, SPF alignment). Aligned DKIM can pass DMARC even when SPF fails (DMARC authentication paths). Passing authentication does not guarantee inbox placement (receiver handling).

For retirement, stop scheduled sends and identify how long the service holds queued retries. Keep legitimate in-transit traffic authorized until it is accounted for; silence in a short sample is not enough. Only then remove the retired authorization, and recheck both the remaining senders and the retired path, because another mechanism may still authorize its IP. DNS removal alone does not decommission the service. Review RFC 7208 transition guidance and RFC 5321 SMTP queues and retries.

If an active sender fails unexpectedly, an unexplained permerror or temperror occurs, the policy is ambiguous, or an envelope identity is wrong, pause or reroute the affected sending. Restore the saved valid policy only if its authorizations remain approved, and re-verify after cache expiry. Rolling back DNS will not re-enable disabled apps, and the old policy may exclude the new sender. Track the procedure with the DNS change checklist.

Frequently asked questions

Can I add a second SPF record for the new vendor?

No. You must publish exactly one SPF record per domain because having two causes an immediate permerror failure. Edit the existing TXT record to include the new mechanism before the terminating all mechanism.

Which mechanisms count toward the ten-lookup limit?

Only include, a, mx, ptr, exists, and redirect trigger DNS lookups, so only they count toward the limit. The initial record fetch and mechanisms like ip4, ip6, and all do not count against this ten-term budget.

Does staying under ten lookups mean the record is valid?

No. Your record can stay under ten lookups and still fail if an included domain lacks a valid SPF policy or returns a syntax error. A missing policy triggers permerror, while an upstream DNS timeout causes a temperror result.

Does a DMARC pass prove the SPF change worked?

No. DMARC can pass entirely on an aligned DKIM signature even when SPF fails or evaluates an unrelated envelope domain. You must inspect the Authentication-Results header to confirm that smtp.mailfrom passed specifically.

When can I remove a retired sender from SPF?

Only after shutting off outbound sending and waiting out any provider retry queues. Keep the authorization in place until in-flight traffic clears, then delete the mechanism from your DNS record.

Email deliverability consultant

Get a second opinion on your email setup

Tell me what your customers are seeing or what you’re planning to change. In 30 minutes, we’ll work out what your team can check first and whether a deliverability audit would help.

I led deliverability at GetResponse, designed a dedicated newsletter system for Easy.Tools and helped Youmoney migrate its automated emails in stages. Read the case studies

Book free call

Email deliverability audit

See what I check and read a sample report with recommendations for your team.