Email security

SPF record explained: the 10 lookup limit and how to fix permerror

An SPF record can look correct and still fail at every receiver. The usual causes are too many DNS lookups, two records instead of one, or an ending that allows anyone to send.

What an SPF record is

An SPF record is a TXT record on your domain that starts with v=spf1. It lists the servers and services allowed to send email for your domain. Your domain must have exactly one SPF record. If you have two records, systems treat this as an error.

This means you cannot simply add a new record every time you start using a new email service. Adding a second record will cause your emails to fail security checks. You must instead edit your existing record to include new authorized senders. This ensures your mail reaches the inbox and prevents spoofing.

The 10 lookup limit

The SPF standard, RFC 7208, allows at most 10 DNS lookups while a record is evaluated. Mechanisms such as a, mx, ptr, and exists count toward this limit. The redirect modifier also counts. Lookups inside every included record count toward the limit as well.

Going over this limit results in a permerror. Email receivers treat messages with a permerror as failing SPF. This means your emails may be blocked or sent to spam folders because the receiving server cannot verify the sender.

How the record should end

You must choose how to end your record to tell receiving servers how to handle unauthorized mail. Using -all creates a hard fail. This tells the server to reject mail from any source not listed in your record. Using ~all creates a soft fail. This allows the server to accept the mail but mark it as suspicious.

Other options like ?all or +all are less effective. Neutral or allow settings permit any server to send mail on your behalf. This defeats the purpose of using a record for security. Your choice determines if your company prioritizes strict rejection or flexible warnings for unverified mail.

Fixing a record that fails

You can fix a failing record by removing services you no longer use. Another option is to replace an include with the addresses it lists. This process is called flattening. You must keep the list up to date when the provider changes it. You can also send marketing email from a subdomain with its own SPF record.

These changes reduce the number of lookups your record requires. This prevents errors and ensures your email reaches the recipient. Review your current services to see what you can remove. Use a subdomain for marketing to separate those lookups from your main record. Flattening is a more manual process but it solves the limit issue.

Questions

How do I count SPF lookups?

Count each include, a, mx, ptr, exists, and redirect. You must also count the same mechanisms found inside each included record.

Is ~all good enough?

~all is common and acceptable while DMARC enforcement is in place. However, -all is stricter.

Last updated 04 November 2026. PrautoForge makes Questionnaire Autopilot. This guide is general information, not legal or compliance advice. Check the official source before acting. Free tool: email security check.