Start with what SPF checks
Sender Policy Framework (SPF) is a DNS-based way for a domain to identify systems permitted to send email on its behalf. The policy is published as a TXT record that begins with v=spf1. A receiving mail server can compare the connecting server’s IP address with that policy when checking the domain used in the message’s envelope sender, or sometimes its HELO identity.
That distinction matters: SPF does not directly authenticate the visible From address a reader sees in an email app. DMARC can use SPF as part of a check involving that visible address, but SPF alone answers a narrower question. A record is best read as a list of tests for an incoming connection, not as a list of people or mailboxes allowed to send.
Read the record from left to right
Consider this illustrative record for example.com: v=spf1 ip4:192.0.2.0/24 include:_spf.example.net a:mail.example.com mx ~all. The domains and IP range are examples, not a ready-to-use policy. After the version tag, the receiving server evaluates mechanisms in order. When one matches, its qualifier determines the SPF result.
A qualifier is the character immediately before a mechanism. A plus sign means pass and is the default when no qualifier is shown. A minus sign means fail, a tilde means softfail, and a question mark means neutral. In the sample, the first four mechanisms have an implied plus sign. The final ~all produces softfail if none of the earlier mechanisms match. Order matters because a match stops evaluation.
Recognize ip4 and include
The ip4 mechanism matches an IPv4 address or range. In the sample, ip4:192.0.2.0/24 represents a block of IPv4 addresses. A single address can also appear without a range suffix. This mechanism is useful when a domain owner knows the outbound IP addresses of a mail server. It does not authorize every server at a hosting company unless the specified range covers them.
The include mechanism refers to another domain’s SPF policy. For example, include:_spf.example.net would match if that domain’s SPF evaluation returns pass for the connecting IP. It does not paste every result from the other record into the current one. Mail providers may ask customers to add an include so their sending infrastructure is covered, but the exact value should come from the provider’s configuration guidance. Each include adds a DNS-dependent step, so long chains can make a record harder to maintain.
Understand a, mx and the final all
The a mechanism checks addresses returned by a domain’s address records. In a:mail.example.com, it checks the addresses for mail.example.com. A bare a uses the domain whose SPF policy is being evaluated. This can be convenient if the named host’s address changes, but it may also authorize an address that was intended for another purpose. Check what the name resolves to before relying on it.
The mx mechanism checks the addresses of the hosts named in a domain’s MX records. A bare mx uses the domain being evaluated; it does not mean “authorize my email provider” unless that provider’s outbound servers match those MX hosts. MX records normally identify where a domain receives mail, and receiving and sending infrastructure may differ.
The all mechanism matches any address, so it belongs at the end. With -all, unmatched senders produce an SPF fail; with ~all, they produce a softfail. A record ending in +all effectively permits every sender and defeats the purpose of a restrictive policy. Choose an ending only after accounting for legitimate senders, including services that send mail using your domain.
Review a policy before changing it
When reading an existing SPF record, list each system that sends mail using the domain’s envelope sender. Then connect those systems to the relevant ip4, include, a or mx entries. Do not assume that a service belongs in the record merely because it receives your mail or appears in the visible From address. If an entry is unfamiliar, identify its purpose before removing it.
Keep the policy manageable. SPF has a limit on DNS-lookup-causing terms during evaluation; mechanisms such as include, a and mx can contribute to that limit, while ip4 does not require a DNS lookup to match. Adding entries indefinitely can therefore cause errors rather than improve coverage. A clear record is easier to maintain: authorize known senders, use the final all mechanism to state what happens to everything else, and revisit the policy when your sending setup changes.



