A customer receives an invoice that appears to come from your company, but it was sent by a criminal using your domain name. Or, just as damaging, a legitimate quote, password reset, or order update lands in a customer’s spam folder. Email authentication helps reduce both risks. Knowing how to configure SPF records gives receiving mail servers a clear way to verify which systems are allowed to send email for your business.
SPF, or Sender Policy Framework, is a DNS record that identifies approved email senders for a domain. It is not complicated once you know which services send mail on your behalf, but one missing service or one extra SPF record can cause delivery problems. The goal is accuracy: authorize legitimate senders, remove outdated ones, and publish one properly structured SPF record.
An SPF record is published as a TXT record in DNS. When an email server receives a message claiming to be from your domain, it can check that record to see whether the sending server is authorized.
For example, your domain may send mail through your hosting email service, Microsoft 365, Google Workspace, an ecommerce platform, a customer relationship management system, or a marketing platform. Each can require an SPF authorization. Your record tells receiving servers which of those systems are permitted to use your domain in the envelope sender address.
SPF is one part of email authentication, not a complete anti-spoofing solution by itself. DKIM adds a cryptographic signature to messages, while DMARC tells receiving servers how to handle messages that fail authentication and whether the visible From address aligns with SPF or DKIM. For business email, these controls work best together.
Most SPF mistakes begin with an incomplete list. Do not build a record based only on the mailbox provider employees use every day. Think about every application that sends messages with an address at your domain.
Start with your primary email platform. Then check website contact forms, WordPress plugins, ecommerce order notifications, accounting software, help desk tools, appointment platforms, payroll services, marketing systems, and transactional email providers. A web application might send mail through your hosting server, or it might use a separate SMTP provider. Those are different sending sources and should be accounted for separately.
Also determine where your DNS is managed. Your domain may be registered with one provider while its authoritative DNS is hosted elsewhere. Add or edit the SPF TXT record only where the active DNS zone is managed. If you make changes in the wrong control panel, nothing will change publicly.
Keep a simple record of each approved sender, the domain it uses, and the SPF guidance supplied by that provider. This makes future updates much safer when you change email services or add a new business platform.
Sign in to the DNS management area for your domain. Look for a section labeled DNS Management, Zone Editor, DNS Records, or something similar. You will add or update a TXT record for the root of the domain, usually represented by an @ symbol.
A basic SPF record starts with the version tag:
`v=spf1`
You then add mechanisms that authorize your actual email sources. A business using its domain’s MX mail servers and one dedicated outbound mail server might use a record similar to this:
`v=spf1 mx ip4:198.51.100.25 -all`
In this example, `mx` authorizes the servers named in the domain’s MX records, and `ip4` authorizes one IPv4 address. The address is only an example. Never copy an IP address unless it is assigned to your approved sending system.
Many third-party providers publish an SPF policy that you include in your record. For example, a business that sends mail through Microsoft 365 may need an entry similar to:
`include:spf.protection.outlook.com`
Google Workspace commonly uses its own include mechanism, while marketing and ecommerce platforms may provide separate include statements or a specific sending domain configuration. Use each provider’s current published instructions rather than guessing. Their requirements can change, and some platforms recommend sending from a dedicated subdomain instead of your primary domain.
A combined record could look like this:
`v=spf1 mx include:spf.protection.outlook.com include:sendgrid.net -all`
The exact providers in your record will differ. The principle is straightforward: add only the mail systems that are genuinely authorized to send mail for the domain.
Every SPF record should end with an all mechanism. The ending tells receiving servers what to do with mail from a sender that did not match an approved source.
`-all` is a hard fail. It states that all other sources are unauthorized. This is the preferred setting once you have verified every legitimate sender.
`~all` is a soft fail. It indicates that unlisted sources are probably unauthorized, but it is more forgiving while you are testing a new setup.
`?all` is neutral and provides very little protection. It is rarely the right long-term choice for a business domain.
If you are replacing an uncertain legacy record, begin with `~all`, test every business system, and move to `-all` after you confirm that legitimate mail is delivering correctly. A hard fail without a complete sender inventory can disrupt important messages, so the cautious approach is often worth it.
A domain must have one SPF TXT record. This rule matters because a common mistake is creating a second TXT record every time a new service is added. Receiving servers can treat multiple SPF records as a permanent error, which can harm delivery rather than improve it.
If an SPF record already exists, edit and combine it. Keep one `v=spf1` at the beginning, place all approved mechanisms after it, and use a single `-all` or `~all` at the end.
For example, these two separate records are incorrect:
`v=spf1 include:spf.protection.outlook.com -all`
`v=spf1 include:sendgrid.net -all`
They should be merged into one record:
`v=spf1 include:spf.protection.outlook.com include:sendgrid.net -all`
Avoid adding old providers “just in case.” An outdated include can leave a former vendor authorized to send mail using your domain. Remove a provider only after confirming that no active mailbox, website, automated notification, or campaign depends on it.
SPF has a technical limit of 10 DNS lookups during evaluation. Include mechanisms, redirects, MX checks, and some other mechanisms can trigger lookups. Large organizations with many email vendors can reach the limit quickly, causing SPF to return a permanent error.
This is another reason to limit the record to active senders. Ask each provider whether its SPF include expands into additional lookups, and consider using separate subdomains for distinct services. For instance, marketing mail could use `news.yourdomain.com` while employee mail continues to use `yourdomain.com`. This approach can simplify authentication, improve reporting, and prevent a marketing platform from complicating the primary domain’s SPF record.
Do not use the `ptr` mechanism. It is inefficient, unreliable, and not recommended. Be careful with the `a` and `mx` mechanisms as well. They can be useful when your own hosting environment sends email, but explicit IP addresses or approved provider includes are often easier to audit.
DNS changes may appear quickly, but propagation depends on the record’s TTL and DNS caching. Allow time for the update, then verify that the TXT record publicly displays exactly as intended. Check for accidental quotation marks, duplicate records, line breaks, or a record published under the wrong hostname.
Next, send test messages from every approved source. Send from employee mailboxes, website forms, ecommerce transactions, invoicing tools, and marketing systems. Review the message headers in the receiving mailbox for an SPF result such as `pass`, `fail`, `softfail`, or `permerror`.
A pass confirms the sending source matched your SPF policy. A fail or soft fail usually means that the source is not authorized, the application is sending through an unexpected server, or the envelope sender differs from the address you assumed it used. A permerror can indicate multiple SPF records or too many DNS lookups.
Do not judge success by one Gmail or Outlook test alone. Different recipients apply different spam filtering policies. Test across the inboxes your customers commonly use and watch delivery patterns for several days after a change.
SPF is valuable, but it can break during forwarding because a forwarded message may arrive from a server not listed in the original sender’s SPF record. DKIM often survives forwarding better because the message carries a signed identifier. DMARC gives your business visibility into authentication results and lets you publish a policy for messages that fail alignment.
Set up DKIM with every email platform that supports it, then publish a DMARC record in monitoring mode before enforcing a quarantine or rejection policy. That sequence gives you time to identify overlooked senders without blocking valid business mail.
Business email is part of your customer experience. A correct SPF record helps protect your name, supports dependable delivery, and reduces avoidable confusion for customers and staff. If you manage your domain and email through Knight Web Services, keep your DNS records documented alongside your hosting and mailbox settings so changes remain controlled as your business grows.