<?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: dnsplumber</title>
    <description>The latest articles on DEV Community by dnsplumber (@dnsplumber).</description>
    <link>https://dev.to/dnsplumber</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%2F4269493%2Ff638e636-efe1-493c-9037-6e3471098552.png</url>
      <title>DEV Community: dnsplumber</title>
      <link>https://dev.to/dnsplumber</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dnsplumber"/>
    <language>en</language>
    <item>
      <title>Amazon SES mail failing DMARC? Align DKIM and SPF to your domain</title>
      <dc:creator>dnsplumber</dc:creator>
      <pubDate>Fri, 27 Nov 2026 18:27:26 +0000</pubDate>
      <link>https://dev.to/dnsplumber/amazon-ses-mail-failing-dmarc-align-dkim-and-spf-to-your-domain-3jm9</link>
      <guid>https://dev.to/dnsplumber/amazon-ses-mail-failing-dmarc-align-dkim-and-spf-to-your-domain-3jm9</guid>
      <description>&lt;p&gt;Your app sends through Amazon SES. The code works, the messages go out, and then a receiver reports a DMARC failure.&lt;/p&gt;

&lt;p&gt;The confusing part is that SPF passes. It just doesn't pass for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the alignment breaks
&lt;/h2&gt;

&lt;p&gt;The question is not whether a check passed. It is which domain it passed for.&lt;/p&gt;

&lt;p&gt;Without a custom MAIL FROM, SES uses a subdomain of &lt;code&gt;amazonses.com&lt;/code&gt; as the Return-Path. SPF checks that domain. So SPF passes, but for &lt;code&gt;amazonses.com&lt;/code&gt;, not for your domain. By default, SPF does not align.&lt;/p&gt;

&lt;p&gt;DKIM is the other half. It aligns once Easy DKIM is verified for the domain in your From address. Until then, neither check aligns with your domain.&lt;/p&gt;

&lt;p&gt;SES needs two pieces of DNS to fix this. Easy DKIM signs mail as your domain. A custom MAIL FROM domain makes SPF match your domain.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;Start in the SES console. Create a domain identity, then copy the records from the identity page. The values below show the shape only, and &lt;code&gt;example.com&lt;/code&gt; stands in for your domain.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add the Easy DKIM records.&lt;/strong&gt; SES shows three of these, one per token. Copy each value exactly as shown.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Type:  CNAME
   Name:  &amp;lt;token&amp;gt;._domainkey.example.com
   Value: &amp;lt;token&amp;gt;.&amp;lt;SES signing zone&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Set up a custom MAIL FROM.&lt;/strong&gt; The subdomain is one you choose. Its MX record receives bounces and complaints.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Type:  MX
   Name:  &amp;lt;mail-from&amp;gt;.example.com
   Value: 10 feedback-smtp.&amp;lt;region&amp;gt;.amazonses.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Publish SPF for the MAIL FROM subdomain.&lt;/strong&gt; This record is for that subdomain only. It does not go into the SPF record at &lt;code&gt;example.com&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Type:  TXT
   Name:  &amp;lt;mail-from&amp;gt;.example.com
   Value: "v=spf1 include:amazonses.com ~all"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add a DMARC record, if you don't have one yet.&lt;/strong&gt; Start with &lt;code&gt;p=none&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Type:  TXT
   Name:  _dmarc.example.com
   Value: v=DMARC1; p=none; rua=mailto:dmarc@example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With these in place, SPF aligns through the custom MAIL FROM, as long as your DMARC record does not set &lt;code&gt;aspf=s&lt;/code&gt;. DKIM aligns through Easy DKIM. If you send from a subdomain of the verified domain, DMARC needs relaxed DKIM alignment, so leave out &lt;code&gt;adkim=s&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Strictly, DKIM alignment alone is enough for DMARC to pass. Set up the custom MAIL FROM as well, so that SPF aligns too.&lt;/p&gt;

&lt;h2&gt;
  
  
  The small things that undo it
&lt;/h2&gt;

&lt;p&gt;A few common mistakes can still undo the setup.&lt;/p&gt;

&lt;p&gt;Some DNS hosts append &lt;code&gt;example.com&lt;/code&gt; to the name you type, so your domain ends up in the name twice. Enter only the part before your domain, or end the full name with a period. Watch the underscore too: the name is &lt;code&gt;&amp;lt;token&amp;gt;._domainkey&lt;/code&gt;, not &lt;code&gt;_&amp;lt;token&amp;gt;._domainkey&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The MAIL FROM MX record deserves a second look. If it is not set up correctly and Behavior on MX failure is set to Use default MAIL FROM domain, SES falls back to a subdomain of &lt;code&gt;amazonses.com&lt;/code&gt;, and SPF stops aligning. DKIM still carries DMARC, but you have lost the second check. Keep that subdomain to one MX record as well. More than one makes the setup fail, so don't use it to send or receive other mail.&lt;/p&gt;

&lt;p&gt;If you send from a second AWS Region, that Region needs its own verified identity and its own records.&lt;/p&gt;

&lt;p&gt;And if your DNS lives on Cloudflare, keep the DKIM CNAMEs DNS only (grey cloud). Cloudflare recommends DNS only for email and domain verification records.&lt;/p&gt;

&lt;h2&gt;
  
  
  Confirming it worked
&lt;/h2&gt;

&lt;p&gt;DNS records tell you what should happen. A real message tells you what did.&lt;/p&gt;

&lt;p&gt;Send yourself a message through SES and look at its headers. You want to see the Return-Path, the DKIM domain, and which of them aligns with your From address. If the Return-Path is now on your MAIL FROM subdomain and the DKIM domain is yours, both checks align.&lt;/p&gt;

&lt;p&gt;To check a DKIM key on its own, the selector is the token: the part of the CNAME name before &lt;code&gt;._domainkey&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The full checklist, with sources, is at &lt;a href="https://maildoctor.dev/guides/amazon-ses-spf-dkim-dmarc" rel="noopener noreferrer"&gt;https://maildoctor.dev/guides/amazon-ses-spf-dkim-dmarc&lt;/a&gt;. To read alignment from a real message, paste its headers into &lt;a href="https://maildoctor.dev/tools/email-header-analyzer" rel="noopener noreferrer"&gt;https://maildoctor.dev/tools/email-header-analyzer&lt;/a&gt;, which shows the Return-Path, the DKIM domain, and which of them aligns.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written with AI assistance and checked against the AWS SES documentation.&lt;/em&gt;&lt;/p&gt;

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