Facebook tracking pixel

MailGenius

How to Set SPF Record Without a Permerror

In 2025, 3,666,641 of the 10 million most popular internet domains, 36.7%, published a syntactically valid SPF record, according to Fortra's DMARC adoption report. That means most domains still leave this basic check undone or broken. When you set SPF record settings correctly, you're doing something simple. You're publishing one merged authorization list that tells receivers which servers may send mail for your domain.

Why One SPF Record Decides Gmail Delivery

An SPF record is one DNS TXT entry on your domain root. It starts with v=spf1, lists every server allowed to send for that domain, and ends with ~all while you're testing. That's the whole job. Publish exactly one record, and make sure it covers every legitimate sender.

Gmail turned this from good hygiene into a delivery requirement. Since February 1, 2024, Google's sender requirements require every sender to Gmail accounts to authenticate with SPF or DKIM, and bulk senders sending 5,000 or more messages a day to Gmail must use SPF, DKIM, and DMARC with the authenticated domain aligned to the visible From address. Mail that fails can be rate-limited, filtered to spam, or rejected.

Don't think of SPF as a score for your copy. It checks the connecting server against your published list. A great subject line won't rescue mail from an unauthorized host, and a passing record won't fix weak content. SPF answers one narrow question well, and that's why it pairs with DKIM and DMARC rather than replacing them. A quick check with a DMARC checker after you publish helps confirm the pieces line up.

RFC 7208 standardizes the format, so receivers everywhere read the same syntax the same way. Get the record right first. Then deal with the lookup budget, forwarding failures, and result codes in that order.

Copy Ready SPF Strings for Common Senders

Start with the string that matches your sending setup, then merge. Don't stack records. If two tools send for you, both belong inside the same TXT entry.

Sending case Mechanisms Example record Publish alone?
Google Workspace only include:_spf.google.com v=spf1 include:_spf.google.com ~all Yes, if nothing else sends
Microsoft 365 only include:spf.protection.outlook.com v=spf1 include:spf.protection.outlook.com ~all Yes, if nothing else sends
Microsoft 365 plus two office IPs ip4:192.168.0.10 ip4:192.168.0.12 include:spf.protection.outlook.com v=spf1 ip4:192.168.0.10 ip4:192.168.0.12 include:spf.protection.outlook.com -all Yes, after those IPs are confirmed
Cloudflare Email plus another vendor include:_spf.mx.cloudflare.net include:other-service.com v=spf1 include:_spf.mx.cloudflare.net include:other-service.com ~all Only after the second include is the vendor's real value
Server you operate ip4 or ip6 v=spf1 ip4:192.168.0.10 ~all Yes, for that host only
Workspace and Microsoft 365 together both includes in one record v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all Yes, as the single merged TXT
Second TXT also starting v=spf1 two policies do not publish No, causes permerror

How Two Vendor Strings Become One Record

Say your team uses Google Workspace for daily mail and Microsoft 365 for a second team. Each vendor's setup page gives you its own complete record. If you paste both into DNS as separate TXT entries, you've just broken SPF for everyone. Receivers see two policies, can't choose between them, and return permerror.

Microsoft's SPF configuration guidance shows the merged pattern with fixed addresses plus Microsoft 365 in a single record, v=spf1 ip4:192.168.0.10 ip4:192.168.0.12 include:spf.protection.outlook.com -all, and any other provider's authorization has to be merged into that same entry. The method is always the same. Keep one v=spf1 prefix, list each mechanism once, and finish with a single ending.

So the Workspace and Microsoft case collapses into v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all. One prefix. Two includes. One ending. That's the value you publish.

Rules That Keep the Copy honest

Copy every include from the vendor's current setup page. Includes are vendor-specific, they change, and guessing one from an old blog post is how records rot. If your hosting panel, such as cPanel or Plesk, exposes a DNS zone editor, you'll add the TXT entry there exactly as you built it. Don't let the panel split it into two records.

Notice the difference between mechanism types. An include spends part of your lookup budget because the receiver has to fetch another record. An ip4 or ip6 for a server you control doesn't, because the address sits right there in your record. That distinction matters once several platforms send for you.

Practical rule: Keep ~all while you're still testing. Move to -all only after every sender on your list has passed a live test.

The ending deserves a plain warning. +all authorizes every host on the internet to send as your domain. Never publish it. And while you're reviewing which mailbox platform each team needs, it helps to think through matching email plans to storage needs before you commit another sender to the record. Every platform you add is a platform you have to keep in the record and keep testing.

You now have one string. The next job is typing that single value into DNS in the right place, without creating a duplicate.

How to Publish the SPF TXT Record

A record is only as good as what resolvers serve, so before you edit anything, query the TXT records for your domain and note any existing line that begins with v=spf1. Your new value will replace that line, not sit beside it. Two v=spf1 records hand receivers two competing policies, and the result is permerror rather than a coin toss.

A four-step infographic illustrating how to publish an SPF TXT record for email security and domain authentication.

The Eight Steps in Order

  1. List every sender: Write down every system that sends with this domain's envelope-from address. That includes Google Workspace, Microsoft 365, your newsletter tool, receipt and transactional mail, a CRM, a help desk, website forms, and any on-premises server.
  2. Build one string: Start with v=spf1, add only the mechanisms for those systems, and end with ~all while you're testing. Treat it as one merged authorization list: when a new sending platform joins later, you edit this record to add its include, you never create a second one.
  3. Open the right DNS screen: Sign in to the DNS host for your apex domain, such as Cloudflare, GoDaddy, or Amazon Route 53, and open the root zone. Not a www host.
  4. Create the TXT record: Use host @ or a blank name, paste the full string as the value, and set the TTL to about one hour (3600 seconds). That is a common, practical setting: long enough that resolvers cache the record instead of re-querying it constantly, short enough that a correction still spreads within a workday.
  5. Replace, don't add: If an SPF TXT already exists, overwrite its value. A second record beginning with v=spf1 gives receivers two policies and produces permerror.
  6. Save and wait: DNS changes need time to spread. Google's setup guidance allows up to 48 hours for propagation, though many hosts answer much sooner.
  7. Confirm one record: Query the domain again and verify that exactly one TXT beginning with v=spf1 comes back.
  8. Test every source: Send a real message from each system on your list and read the Authentication-Results header for spf=pass. A record can pass for your email platform while your CRM still fails, and you'd never know from the DNS screen alone.

Why the Order Protects You

The failure this sequence prevents is an incomplete sender inventory. Marketers usually remember the newsletter tool. They forget the help desk, the receipt service, or the website form that sends notifications at 2 a.m. Then the main campaign passes, support mail fails, and the team blames the spam filter.

Build the list first and that problem mostly disappears. You're authorizing senders, not decorating DNS. If a system puts your domain in its envelope sender, it belongs in the record or it will fail the check.

The list also separates two situations that get confused. A new platform your company signs up for, say an outbound sales tool, earns a place in the record through its include. A forwarder that relays your mail onward was never your authorized sender, and pasting its IPs into the record won't repair what breaks downstream.

One more boundary worth stating plainly. SPF authorizes the SMTP envelope sender. It isn't a complete deliverability control, and it doesn't configure DKIM or DMARC for you. Those still need their own setup and validation. For a broader view of how authentication fits into day-to-day protection, Nutmeg Technologies' email security guide is a useful companion read once your record is live.

If a tool sends mail as your domain and it isn't in the record, SPF will treat it like a stranger. That's the record working as designed.

Fix Lookup Limits and Read SPF Results

Your record has a budget. Microsoft's SPF guidance restates the ceiling RFC 7208 sets: a hard maximum of 10 DNS-query-causing mechanisms per evaluation, where include, a, mx, exists, and redirect each consume budget, nested lookups included. Length has its own ceiling. Each character string inside a TXT record is limited to 255 characters, which starts to matter once you list ip4 and ip6 ranges directly. Blow past the lookup budget and receivers return permerror, a hard failure that makes your record read as broken rather than borderline.

An infographic explaining the 10 DNS lookup limit for SPF records to prevent email authentication failure.

Why a Short Record Can Still Fail

The confusion starts with counting. You count the includes you can see, find four, and assume you're safely under ten. But every lookup inside a vendor's own record counts toward your total too. A provider's include often points to another record, which points to more mechanisms, and the receiver chases every one of them on your dime.

Say you stack Google Workspace, Microsoft 365, an outbound sales platform, and a help desk. Your top-level record looks tidy. Underneath, those four vendors may nest enough additional lookups to push you past the limit. RFC 7208 makes that a hard error. The receiver can't reliably evaluate your policy, so it stops trying.

Mechanisms that don't spend budget are your release valve. ip4, ip6, and all require no extra DNS query. That's why a stable server you operate is better expressed as a direct address than as a hostname lookup.

Count It Yourself

  1. Expand each include: Open every vendor record your include points to.
  2. Tally the nested terms: Count every nested include, a, mx, and redirect you find, not just your own.
  3. Cut dead weight: Remove vendors you no longer use and any duplicate includes. Old tools are the most common source of wasted lookups.
  4. Swap stable hosts to addresses: Replace a fixed server you control with ip4 or ip6 to reclaim budget.

Flattening means expanding a provider's ranges into direct ip4 entries yourself. It saves lookups, but it goes stale the moment the vendor changes addresses. If you flatten, schedule re-checks, because a stale list can authorize the wrong infrastructure or make legitimate mail fail without any visible change on your side.

Long records hit a second wall. When an IP list outgrows one string, you can split it into adjacent character strings within the same record, each under the 255-character cap. They still form one logical policy. What you can't do is publish a second v=spf1 record and call it part two.

Read the Result, Then Make One Edit

Result Usual cause Record edit
permerror Two TXT records both start with v=spf1 Delete the extra record and merge its mechanisms
permerror More than 10 DNS lookups including nested includes Remove unused includes or replace a stable host with ip4
fail Connecting IP is absent and the record ends in -all Add that sender's include only if it originates mail
softfail Same miss with ~all during rollout Keep ~all until every source passes, then move to -all
none or neutral No usable v=spf1 TXT at the envelope domain Publish one record at the apex, host @
pass for one tool only Inventory missed the CRM or help desk Add that vendor to the same record and retest

Match each result to one cause and one edit. A single failure means a single change, and that restraint pays off: small edits tell you exactly what fixed the problem.

Watch for mechanical errors too. If you drafted the value in a word processor, smart quotes or stray spaces may have slipped in. Retype the value as plain text directly in the DNS editor, then retest every source after the edit rather than only the one that failed.

One result doesn't belong in this table. A forwarded message that fails SPF is a different case with a different fix, and pasting the forwarder's address into your record won't solve it. The break happens on the forwarding path, and no edit to your authorization list can reach it.

Why Forwarded Mail Still Fails SPF

Say your support alias forwards every message to a Gmail inbox. Your SPF record is correct. Your campaigns pass. Yet the forwarded copies show spf=fail, and someone on the team wants to paste the forwarding server's address into the record. Don't.

The diagram below traces how a forwarded message changes hands between servers, which is where the check breaks.

A professional desk with a laptop displaying a technical diagram of how forwarded mail moves through servers.

What Actually Breaks on a Forward

SPF authenticates the server that connects to the receiver, using the envelope sender. It doesn't authenticate the person or brand shown in the visible From line. When a mailbox forwards a message, the forwarder's server becomes the connecting host. That host almost never appears in the original domain's SPF record, so the check fails even though nobody configured anything wrong.

Microsoft's email authentication troubleshooting guidance treats forwarded messages as a distinct SPF failure scenario and tells admins to understand the forwarding path rather than assuming a missing DNS entry. Adding every possible forwarder isn't scalable anyway. You don't control your customers' auto-forward rules, shared inboxes, corporate aliases, or mailing list servers.

Draw the Line Between Sender and Forwarder

This is the decision that keeps your record clean. Ask one question about the system in front of you. Does it originate mail as your domain, or does it pass along mail that originated somewhere else?

  • It originates mail: A CRM, an email platform, or a help desk sending new messages as your domain needs its include in your one SPF record.
  • It forwards mail: An alias, a list server, or a customer's forwarding rule doesn't get an include. Its failure is expected behavior, not a DNS gap.

The durable fix for forwarding lives elsewhere. Sign your outbound mail with DKIM, and publish DMARC so a passing, aligned DKIM signature can still satisfy your policy when SPF breaks in transit. Where the forwarder supports it, ARC helps preserve authentication results across the hop. That's also practical insurance if you're working through how to stop email from going to spam in Gmail, because one broken check shouldn't sink an otherwise legitimate message.

A pretty record can still fail after a forward. That's not your record lying to you. It's SPF answering a narrower question than the one you asked.

The short video below walks through the forwarding path step by step, so you can see where the connecting host changes.

Confirm the Record With a Live Test

DNS returning one v=spf1 value is a starting point, not proof. Proof is a real message, sent the normal way, from every source on your inventory. Send from your email platform, your CRM, your help desk, and your newsletter tool. Open the Authentication-Results header on each one and look for spf=pass aligned with your From domain.

When every legitimate source passes and nothing is missing, change ~all to -all. That single character is the difference between marking unauthorized hosts as suspicious and telling receivers they hard-fail. Don't make that move early. A sender you forgot will fail loudly the day you do.

Remember what SPF doesn't cover. It handles the envelope check only. DKIM and DMARC still need to be set and aligned, or you've only partly met the bulk sender rules. Running your domain through an SPF and DKIM checker gives you a fast read on whether the records agree with each other.

For the full picture, run the free email spam test on the homepage of MailGenius. Copy the address shown there, send a normal message from the platform you use, and click "See Your Score" to see whether SPF, DKIM, and DMARC line up and what to fix first. Our Authentication Checker runs full SPF, DKIM, DMARC, and BIMI scans in one step and guides you through the fixes. Apply the recommendations, send a fresh test to confirm, and only then scale the campaign.


You just built one merged SPF record inside its lookup budget, so don't guess whether it holds up in a real inbox. Send a test message through MailGenius and get a clear score showing how your SPF, DKIM, and DMARC alignment looks to receiving servers, plus the specific fixes to make first. Run the test, adjust the record, test again, and send your next campaign knowing the authentication is solid.

Free Email Spam Test:

Will your Email Land in the Spam Folder?

Send an email to the address below to see your Spam Score:
loading...
MailGenius users test over 1M emails per year! By using our Email Tester, you will agree to our Privacy Policy and Terms of Service. The sending email address will receive emails from MailGenius. All tests are hosted on public links.

Try MailGenius Today

Run a Free Email Deliverability Test - Send an Email to the Address Below, then Click “See Your Score”:

Free Email Spam Test:

Will your Email Land in the Spam Folder?

Send an email to the address below to see your Spam Score:
loading...
MailGenius users test over 1M emails per year! By using our Email Tester, you will agree to our Privacy Policy and Terms of Service. The sending email address will receive emails from MailGenius. All tests are hosted on public links.

Try MailGenius Today