Skip to main content
Enter TitanOS

Email authentication error

SPF ip4 vs include vs a and mx: which mechanism to use

Every SPF record is built from a handful of mechanisms, and choosing the wrong one for a sender is a common reason records grow too large or authorise more than intended. The four you will meet most are ip4 (and its IPv6 twin ip6), include, a and mx. They differ in what they authorise and in how many DNS lookups they cost.

By Kyle Deligny, Titanos, Brisbane. Last reviewed 1 December 2026. General information, not legal advice.

The cost matters because RFC 7208 stops evaluation with a permerror once a record needs more than 10 lookups. This page explains each mechanism in plain terms and gives a rule of thumb for which to pick.

ip4 and ip6: fixed addresses, no lookups

An ip4 term lists an address or a range, such as 203.0.113.10 or 203.0.113.0/28. A receiver compares the connecting address with the list and needs no DNS query to do it. The same applies to ip6.

This is the cheapest and most precise mechanism. It suits a mail server you run yourself, or an office connection that sends scan-to-email, where the address is stable and you control it. The cost is maintenance: if the address changes, the record must change too.

include: borrow another domain's record

An include term tells the receiver to evaluate another domain's SPF record and to treat a pass there as a pass here. It is how almost every hosted service asks to be added: your mailbox suite, invoicing tool or newsletter platform gives you a domain to include.

The benefit is that the provider keeps its own addresses current. The cost is lookups. The include itself counts as one, and every include, a, mx or exists inside the provider's record counts as well. Providers that chain several includes can use a large share of your 10 on their own. An include for a domain with no SPF record at all causes a permerror, so remove includes for services you cancel.

a and mx: your own web and mail hosts

The a term authorises the addresses that your domain name resolves to, and mx authorises the addresses of the hosts named in your MX records. Each costs one lookup, and mx can cost more, since RFC 7208 allows the receiver to resolve up to 10 MX names and then look up the address of each.

They look convenient and often appear in older templates, but they can authorise more than you meant. If your web host and mail host share a server, the a term authorises everything that server sends. If your MX points to a filtering gateway, mx authorises that gateway, which may not send your outbound mail at all.

Use them only when you know the answer to the question what actually sends mail from these addresses. Otherwise prefer a direct ip4 entry.

A rule of thumb

For a server you control with a fixed address, use ip4 or ip6. For a hosted service whose addresses change, use include and watch the count. For your own web or mail hosts, replace a and mx with the actual addresses once you have confirmed them. For bulk senders that would push you over the limit, give them a subdomain and their own record.

Whatever you pick, end the record with an all term and keep it to one record per domain. Our SPF builder shows the lookup count for each choice, and our page on too many DNS lookups covers what to do once you are over.

Choose the right SPF mechanism for each sender

  1. List every system that sends mail as your domain, from DMARC reports and staff input.
  2. Mark each as self-run with a fixed address or as a hosted service.
  3. Use ip4 or ip6 for fixed addresses you control and write down who owns each.
  4. Use include for hosted services and copy the domain from the provider's own help page.
  5. Check each included domain publishes a valid SPF record.
  6. Replace a and mx terms with real addresses after confirming what sends from them.
  7. Count lookups across the whole record and keep it at 10 or fewer.
  8. Put the all term last and choose the qualifier on purpose.
  9. Publish a single record and test it with a message to an outside mailbox.
  10. Review the record whenever you add or cancel a service.

Questions people ask

Which SPF mechanisms cost a DNS lookup?

Under RFC 7208 the include, a, mx, ptr and exists mechanisms and the redirect modifier each trigger a query. The ip4, ip6 and all mechanisms do not.

Is it safe to use the mx mechanism?

It is safe if the hosts in your MX records are the same systems that send your outbound mail. If they only receive mail, as a filtering gateway often does, it authorises addresses you did not intend to.

Should I use ptr?

No. RFC 7208 says the ptr mechanism should not be used because it is slow and unreliable, and it costs lookups.

Can I mix all four in one record?

Yes. Terms are checked from left to right and the first match decides the result, so order them with the most common senders first.

Where to from here

The free privacy policy audit reads your published privacy policy against the Australian Privacy Principles and tells you what is missing. Privacy Care keeps your policy and your shopper data practices current for AU$149 a month, with a 3-month minimum. Would it be okay if we showed you what the audit finds? A no is welcome.

Get the free auditSee Privacy CareBook a call

Sources

  1. RFC 7208, Sender Policy Framework, section 5 (mechanisms) and 4.6.4 (limits)
  2. ASD, how to combat fake emails
  3. RFC 7489, DMARC
Book a free call