<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hanzala Rasool</title>
    <description>The latest articles on DEV Community by Hanzala Rasool (@hanzala_rasool_6d069eeab1).</description>
    <link>https://dev.to/hanzala_rasool_6d069eeab1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4242226%2F1cafd729-1bd4-4572-8261-f0db81783762.jpg</url>
      <title>DEV Community: Hanzala Rasool</title>
      <link>https://dev.to/hanzala_rasool_6d069eeab1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hanzala_rasool_6d069eeab1"/>
    <language>en</language>
    <item>
      <title>How to fix "SPF permerror: too many DNS lookups"</title>
      <dc:creator>Hanzala Rasool</dc:creator>
      <pubDate>Fri, 13 Nov 2026 05:43:13 +0000</pubDate>
      <link>https://dev.to/hanzala_rasool_6d069eeab1/how-to-fix-spf-permerror-too-many-dns-lookups-1f0a</link>
      <guid>https://dev.to/hanzala_rasool_6d069eeab1/how-to-fix-spf-permerror-too-many-dns-lookups-1f0a</guid>
      <description>&lt;p&gt;SPF has a hard limit: checking your record may take no more than &lt;strong&gt;10 DNS lookups&lt;/strong&gt;. Go over it and the result is &lt;code&gt;permerror&lt;/code&gt;, which many receivers treat as a failed SPF check, so your mail is more likely to land in spam. It usually creeps up on you as you add more services that send email for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  What counts towards the 10
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Counts:&lt;/strong&gt; &lt;code&gt;include:&lt;/code&gt;, &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;mx&lt;/code&gt;, &lt;code&gt;ptr&lt;/code&gt;, &lt;code&gt;exists:&lt;/code&gt; and &lt;code&gt;redirect=&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Doesn't count:&lt;/strong&gt; &lt;code&gt;ip4:&lt;/code&gt;, &lt;code&gt;ip6:&lt;/code&gt; and &lt;code&gt;all&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nested lookups count too.&lt;/strong&gt; &lt;code&gt;include:_spf.google.com&lt;/code&gt; is one lookup, but Google's record includes others, and those count against your 10 as well.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Find what's using your lookups
&lt;/h2&gt;

&lt;p&gt;Look at your current record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nslookup -type=txt yourdomain.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Count every &lt;code&gt;include&lt;/code&gt;, &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;mx&lt;/code&gt;, &lt;code&gt;ptr&lt;/code&gt; and &lt;code&gt;exists&lt;/code&gt;, then repeat for each included domain. Or paste your domain into a checker that does it for you, like this &lt;a href="https://imageconvert.art/tools/spf-dmarc-check" rel="noopener noreferrer"&gt;free SPF &amp;amp; DMARC check&lt;/a&gt;. If the top level is already close to 10, the includes inside it almost certainly push you over.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five ways to get under the limit
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Remove services you no longer use.&lt;/strong&gt; Old newsletter tools and CRMs are the usual culprits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replace &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;mx&lt;/code&gt; with &lt;code&gt;ip4:&lt;/code&gt;&lt;/strong&gt; if your own servers have fixed IP addresses. IP addresses don't use lookups.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remove &lt;code&gt;ptr&lt;/code&gt;.&lt;/strong&gt; It's deprecated and slow anyway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send marketing mail from a subdomain&lt;/strong&gt;, such as &lt;code&gt;news.yourdomain.com&lt;/code&gt;, with its own SPF record. Each domain gets its own 10 lookups.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flatten carefully.&lt;/strong&gt; Replacing an include with the IP addresses it contains saves lookups, but if the provider changes its IPs your SPF silently breaks. Only flatten with a tool that keeps it updated.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Don't forget DKIM
&lt;/h2&gt;

&lt;p&gt;DMARC passes if &lt;em&gt;either&lt;/em&gt; SPF or DKIM passes and aligns with your domain. Setting up DKIM for every service that sends as you makes SPF less critical, and some services can't be added to SPF at all without going over the limit.&lt;/p&gt;

&lt;p&gt;Quick end-to-end test: send yourself an email in Gmail, open it, choose &lt;strong&gt;Show original&lt;/strong&gt;, and look for &lt;code&gt;PASS&lt;/code&gt; next to SPF, DKIM and DMARC.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://imageconvert.art/guides/spf-too-many-dns-lookups" rel="noopener noreferrer"&gt;imageconvert.art&lt;/a&gt;, where there's also a &lt;a href="https://imageconvert.art/guides/spf-dkim-dmarc-setup" rel="noopener noreferrer"&gt;full SPF, DKIM and DMARC setup guide&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>email</category>
      <category>dns</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
