What is an SPF record?
SPF (Sender Policy Framework) is an email authentication mechanism that specifies which mail servers are authorised to send email on behalf of a domain. Published as a TXT record in DNS, it lists IP addresses, hostnames, or other domains that can legitimately send email from your domain. When a receiving mail server gets an email claiming to be from your domain, it checks your SPF record to verify the sender is authorised. SPF helps prevent email spoofing and improves deliverability.
What does -all vs ~all mean?
-all (hard fail) means any server not explicitly listed in the SPF record should be rejected. This is the strictest setting and the most secure. ~all (soft fail) means unlisted servers should be treated with suspicion but not necessarily rejected — the receiving server marks it as suspicious and may deliver it to spam. +all (pass all) means any server can send email as your domain — this is extremely insecure and should never be used. ?all (neutral) makes no recommendation.
What is the 10 DNS lookup limit?
The SPF specification limits evaluation to 10 DNS lookups. Each include:, a, mx, exists, ptr, and redirect mechanism counts as one lookup. If your SPF record causes more than 10 lookups, receivers return a PermError, which can cause email to be rejected. This is a common problem for organisations using multiple email services (marketing platform + CRM + helpdesk + transactional email) each adding their own include: mechanism. The fix is SPF flattening — replacing include: mechanisms with their resolved IP ranges.
Does SPF alone prevent email spoofing?
SPF alone is not sufficient to prevent spoofing. It only validates the envelope sender (the MAIL FROM address used during SMTP negotiation), not the From: header that users see in their email client. An attacker can craft an email where the envelope sender passes SPF but the visible From: header is your domain. DMARC addresses this by requiring alignment between the envelope sender and the From: header. You should deploy SPF, DKIM, and DMARC together for comprehensive anti-spoofing protection.