<?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: Randy Esperben</title>
    <description>The latest articles on DEV Community by Randy Esperben (@randyesperben).</description>
    <link>https://dev.to/randyesperben</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%2F4264585%2F565d11b2-8c9d-4a9a-a38b-b5a4d7cb0039.png</url>
      <title>DEV Community: Randy Esperben</title>
      <link>https://dev.to/randyesperben</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/randyesperben"/>
    <language>en</language>
    <item>
      <title>How a DNS check decides whether anyone can send email as your domain</title>
      <dc:creator>Randy Esperben</dc:creator>
      <pubDate>Wed, 25 Nov 2026 11:13:00 +0000</pubDate>
      <link>https://dev.to/randyesperben/how-a-dns-check-decides-whether-anyone-can-send-email-as-your-domain-1lj7</link>
      <guid>https://dev.to/randyesperben/how-a-dns-check-decides-whether-anyone-can-send-email-as-your-domain-1lj7</guid>
      <description>&lt;p&gt;Anyone can put any domain in the From line of an email. Receivers decide whether to believe it by reading three DNS records the domain publishes: SPF, DKIM and DMARC. A DNS check can read those records and answer one question: can anyone send email as this domain? Below are the rules one such check uses, each with the RFC section behind it, and real records from a public test zone so you can run &lt;code&gt;dig&lt;/code&gt; on them yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four possible answers
&lt;/h2&gt;

&lt;p&gt;The check gives one of four verdicts: &lt;strong&gt;Spoofable&lt;/strong&gt;, &lt;strong&gt;Partly protected&lt;/strong&gt;, &lt;strong&gt;Protected&lt;/strong&gt; or &lt;strong&gt;Can't tell&lt;/strong&gt;. It gives no score. It tries the rules in this order and stops at the first match:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Verdict&lt;/th&gt;
&lt;th&gt;When&lt;/th&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Can't tell&lt;/td&gt;
&lt;td&gt;a lookup that could change the answer got no usable answer&lt;/td&gt;
&lt;td&gt;RFC 4035 §4.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Spoofable&lt;/td&gt;
&lt;td&gt;no DMARC policy applies, or the policy is &lt;code&gt;none&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;RFC 9989 §4.10.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Spoofable&lt;/td&gt;
&lt;td&gt;SPF lets the whole internet, or addresses anyone can rent, pass&lt;/td&gt;
&lt;td&gt;RFC 7208 §5.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Partly protected&lt;/td&gt;
&lt;td&gt;the policy is &lt;code&gt;quarantine&lt;/code&gt;, or &lt;code&gt;reject&lt;/code&gt; with &lt;code&gt;sp=none&lt;/code&gt; or &lt;code&gt;np=none&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;RFC 9989 §4.10.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Protected&lt;/td&gt;
&lt;td&gt;the policy is &lt;code&gt;reject&lt;/code&gt; and no subdomain policy is &lt;code&gt;none&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;RFC 9989 §4.10.1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Two DNS operators before any verdict
&lt;/h2&gt;

&lt;p&gt;The check runs in the browser and asks public DNS-over-HTTPS services in this order: Cloudflare, Google, Quad9, Control D, DNS4EU and CZ.NIC.&lt;/p&gt;

&lt;p&gt;For the lookups that decide the verdict (MX, SPF and DMARC), it asks two of them at once, Cloudflare and Google while both answer. If one fails, the next service on the list takes its place. It compares the two answers and uses them only when they match: the same class (records, no records, or no such name) and the same records, with TTL and order ignored.&lt;/p&gt;

&lt;p&gt;If they differ, the verdict is Can't tell, and the result shows both answers. Say you changed &lt;code&gt;p=none&lt;/code&gt; to &lt;code&gt;p=reject&lt;/code&gt; ten minutes ago. One resolver may still hold the old record in its cache. A verdict built from that copy would tell you the domain is spoofable when it is not, or the other way round, and you would have no way to see why. If only one service answers, the verdict is also Can't tell. A third answer never breaks a tie, because a vote between caches proves nothing about the zone.&lt;/p&gt;

&lt;p&gt;Addresses count by class, public or private. Microsoft 365 and Google hand out a different subset of their MX addresses on each query, so comparing them one by one would fail all the time.&lt;/p&gt;

&lt;p&gt;DKIM keys, MTA-STS and TLS-RPT do not decide the verdict, so they go to one service, and the next one takes over if it fails. If the check cannot get an answer for MX, SPF or DMARC, it never says Protected.&lt;/p&gt;

&lt;h2&gt;
  
  
  SPF: 10 lookups, 2 empty ones
&lt;/h2&gt;

&lt;p&gt;RFC 7208 §4.6.4 sets the limits, and a record that crosses one fails for every message:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;10 DNS lookups.&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; cost one each. The check follows each include down to the last record and counts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2 void lookups&lt;/strong&gt;, the ones that come back empty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;10 hosts&lt;/strong&gt; behind one &lt;code&gt;mx&lt;/code&gt; term.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is &lt;code&gt;spf-11-lookups.badmail.dev&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;v=spf1 include:t.spf-11-lookups.badmail.dev include:t.spf-11-lookups.badmail.dev
       ... 11 includes in all ... -all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Receivers stop at the eleventh include and return &lt;code&gt;permerror&lt;/code&gt;. And &lt;code&gt;spf-void.badmail.dev&lt;/code&gt; points at three names that have no address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;v=spf1 a:v1.spf-void.badmail.dev a:v2.spf-void.badmail.dev a:v3.spf-void.badmail.dev -all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The third empty lookup is one past the limit.&lt;/p&gt;

&lt;p&gt;Both cases get Protected as their verdict. A broken SPF record fails SPF, and DMARC at &lt;code&gt;reject&lt;/code&gt; still rejects mail that fails. Your real mail is what suffers, so the check reports these under a second answer, "Will your real email arrive?", as At risk.&lt;/p&gt;

&lt;p&gt;SPF changes the spoofing verdict in one case: a branch that receivers evaluate lets anyone pass. That means &lt;code&gt;+all&lt;/code&gt;, &lt;code&gt;ip4:0.0.0.0/0&lt;/code&gt;, &lt;code&gt;ip6:::/0&lt;/code&gt;, an &lt;code&gt;a&lt;/code&gt; or &lt;code&gt;mx&lt;/code&gt; with a &lt;code&gt;/0&lt;/code&gt; prefix, a range wider than /16 for IPv4 or /32 for IPv6 that holds cloud addresses, or &lt;code&gt;exists&lt;/code&gt; without macros on a name that has an address. An attacker can rent a cloud server in that range, pass SPF for your domain, and pass DMARC through SPF alignment. &lt;code&gt;p=reject&lt;/code&gt; does nothing against that, so row 3 sits above the DMARC rows.&lt;/p&gt;

&lt;h2&gt;
  
  
  DMARC: the policy for the exact name
&lt;/h2&gt;

&lt;p&gt;DMARC asks receivers what to do with mail that fails: &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;quarantine&lt;/code&gt; or &lt;code&gt;reject&lt;/code&gt;. The check works out the effective policy for the exact name you typed. A name with its own record uses its &lt;code&gt;p&lt;/code&gt;. A name that inherits from its organizational domain uses &lt;code&gt;sp&lt;/code&gt; if it exists and &lt;code&gt;np&lt;/code&gt; if it does not (RFC 9989 §4.7).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;np&lt;/code&gt; covers more mail than you might expect. An attacker has no need for a real subdomain: &lt;code&gt;invoice.example.com&lt;/code&gt; does not have to exist for a message from it to reach an inbox. So &lt;code&gt;v=DMARC1; p=reject; np=none&lt;/code&gt; leaves that door open, and the check calls it Partly protected and suggests &lt;code&gt;sp=reject; np=reject&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Two DMARC standards at once
&lt;/h3&gt;

&lt;p&gt;RFC 9989 replaced RFC 7489 in May 2026. Some receivers may still follow RFC 7489, and your records cannot tell you which kind reads your mail. So the check works out the policy each kind would apply, and the verdict follows the weaker one. The two differ in six places. Three of them change verdicts most often:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Organizational domain.&lt;/strong&gt; RFC 9989 walks up the DNS tree from the name. RFC 7489 uses the Public Suffix List. With a record only at &lt;code&gt;mail.example.com&lt;/code&gt;, RFC 9989 applies it to &lt;code&gt;a.mail.example.com&lt;/code&gt;. RFC 7489 looks at &lt;code&gt;example.com&lt;/code&gt;, finds nothing and applies no DMARC.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;np&lt;/code&gt;.&lt;/strong&gt; RFC 7489 has no &lt;code&gt;np&lt;/code&gt; and applies &lt;code&gt;sp&lt;/code&gt; to names that do not exist, so for those names the weaker of &lt;code&gt;np&lt;/code&gt; and &lt;code&gt;sp&lt;/code&gt; counts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;pct&lt;/code&gt; and &lt;code&gt;t=y&lt;/code&gt;.&lt;/strong&gt; RFC 7489 §6.6.4 has &lt;code&gt;pct&lt;/code&gt;: apply the policy to that share of failing mail and one level less to the rest. RFC 9989 removed &lt;code&gt;pct&lt;/code&gt; and added &lt;code&gt;t=y&lt;/code&gt;: apply one level less to all of it while you test (RFC 9989 §4.7). A record with &lt;code&gt;p=reject; pct=50&lt;/code&gt; asks an RFC 7489 receiver to reject half of the forged mail and quarantine the other half. The fix the check gives: remove &lt;code&gt;pct&lt;/code&gt;, and use &lt;code&gt;t=y&lt;/code&gt; while you test.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The simplest case in the test zone is &lt;code&gt;_dmarc.dmarc-none.badmail.dev&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;v=DMARC1; p=none
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verdict: Spoofable. The record asks receivers to take no action on mail that fakes the domain.&lt;/p&gt;

&lt;h2&gt;
  
  
  DKIM: keys you cannot list
&lt;/h2&gt;

&lt;p&gt;A DKIM key sits at &lt;code&gt;&amp;lt;selector&amp;gt;._domainkey.&amp;lt;domain&amp;gt;&lt;/code&gt;. The sender picks the selector and writes it in the &lt;code&gt;s=&lt;/code&gt; tag of each signature (RFC 6376 §3.6.2.1). DNS offers no way to list the selectors under a name, so a DNS check has to guess.&lt;/p&gt;

&lt;p&gt;The check tries 76 selectors. 73 come from the documentation of the service or program that uses them, and the other 3 were seen in DNS. Each one is listed with its source, along with the MX hosts, SPF includes and DKIM targets of 66 email providers. On 19 November 2026, 67.9% of 2,707 domains with MX in a Tranco sample (list L5KW4) had a key at one of those selectors. For the other 32.1%, the check cannot tell whether they sign with a selector it did not try, and it says that.&lt;/p&gt;

&lt;p&gt;Two cases let it say more. If the zone is signed with DNSSEC and both operators answer that &lt;code&gt;_domainkey.&amp;lt;domain&amp;gt;&lt;/code&gt; does not exist, no key can sit under it, and the check says the domain publishes no DKIM keys. If something exists under &lt;code&gt;_domainkey&lt;/code&gt; and no selector answers, a key probably sits under a selector the check did not try. A wildcard under &lt;code&gt;_domainkey&lt;/code&gt; answers every selector the same way, so the check credits it to none of them.&lt;/p&gt;

&lt;p&gt;DKIM never changes the spoofing verdict by itself, because DMARC passes with either SPF or DKIM aligned. It feeds the delivery answer: if every key found is shorter than 1024 bits, limited to sha1, malformed or in testing mode, delivery is At risk (RFC 8301 §3).&lt;/p&gt;

&lt;h2&gt;
  
  
  Null MX
&lt;/h2&gt;

&lt;p&gt;A domain that receives no mail can say so with one MX record of preference 0 and a dot as the host (RFC 7505 §3):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example.com.  MX  0 .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Parked and website-only domains should publish it, with &lt;code&gt;v=spf1 -all&lt;/code&gt; and DMARC at &lt;code&gt;p=reject&lt;/code&gt;. A domain that sends no email can still appear in the From line of a forged one.&lt;/p&gt;

&lt;p&gt;The check uses it in the delivery answer. A null MX on a domain with no sign of sending gives "No email". A null MX next to other MX records is At risk. That is what &lt;code&gt;mx-null-plus.badmail.dev&lt;/code&gt; publishes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight email"&gt;&lt;code&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mx&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;plus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;badmail&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What a DNS check cannot see
&lt;/h2&gt;

&lt;p&gt;It sends no email, so it cannot tell how Gmail or Outlook will treat yours; each receiver keeps the final say (RFC 9989 §5.4). It cannot read a DKIM key under a selector it does not know. And no record on your domain stops a lookalike domain one letter away.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test it yourself
&lt;/h2&gt;

&lt;p&gt;badmail.dev is a public DNS zone with 44 cases, most of them broken on purpose, each with the answer the standard gives. Point any checker at them and compare.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was created with the help of AI. Every rule and number in it was checked against the RFCs it cites and against live DNS answers.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dns</category>
      <category>security</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
