<?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: Fourat</title>
    <description>The latest articles on DEV Community by Fourat (@fourat).</description>
    <link>https://dev.to/fourat</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%2F3818097%2F94fb5dd8-3857-41f0-be45-2bdd912ee526.jpeg</url>
      <title>DEV Community: Fourat</title>
      <link>https://dev.to/fourat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fourat"/>
    <language>en</language>
    <item>
      <title>Send your first email with Cloudflare Auto Setup</title>
      <dc:creator>Fourat</dc:creator>
      <pubDate>Mon, 23 Nov 2026 11:08:17 +0000</pubDate>
      <link>https://dev.to/fourat/send-your-first-email-with-cloudflare-auto-setup-k0o</link>
      <guid>https://dev.to/fourat/send-your-first-email-with-cloudflare-auto-setup-k0o</guid>
      <description>&lt;p&gt;&lt;em&gt;I build mailkube, the email API in this walkthrough. The four DNS records it publishes are the same kind any sending provider needs on your domain.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Before a provider can send as your domain, receivers look for four things in that domain's DNS: a DKIM public key, a DMARC policy, an SPF record, and an MX that catches bounces. Pasting a long DKIM key into a DNS panel by hand is the step that's easiest to get wrong. If your DNS is on Cloudflare, mailkube can write all four for you once you approve them on Cloudflare's side, and that's the path this post takes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftsszae7c9hc273jhmcnv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftsszae7c9hc273jhmcnv.png" alt="The Message Details panel of the mailkube dashboard for an email from hello@notify.example.com to jordan@example.com with the subject Welcome to Acme, marked Delivered and API. Its timeline shows Auth and Reception at 17:42:08, then Delivery at 17:42:09 with the reply 250 2.0.0 OK queued as 7RpL3vX9cQ." width="800" height="1034"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The welcome email this tutorial sends, open in Logs. Addresses, the IP and the identifiers are examples.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This tutorial sends your first email from a domain mailkube has never seen. &lt;code&gt;hello@notify.example.com&lt;/code&gt; welcomes &lt;code&gt;jordan@example.com&lt;/code&gt;, and the Logs view shows the message accepted, handed over and delivered. The DNS records come from one click on Cloudflare, so you never copy a DKIM key by hand.&lt;/p&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A mailkube account. The Free plan sends 4,000 emails a month (140 a day) from unlimited domains.&lt;/li&gt;
&lt;li&gt;A domain whose DNS is hosted on Cloudflare.&lt;/li&gt;
&lt;li&gt;Python 3.12 or later, or Go 1.23 or later, for the SDK sections. The curl section needs nothing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every example uses &lt;code&gt;notify.example.com&lt;/code&gt;. Replace it with your own sending domain.&lt;/p&gt;
&lt;h2&gt;
  
  
  Add the domain
&lt;/h2&gt;

&lt;p&gt;In the dashboard, open the domain switcher and pick &lt;strong&gt;Create Domain&lt;/strong&gt;. Add a subdomain rather than your apex: the docs' own example is &lt;code&gt;mail.yourcompany.com&lt;/code&gt;, and a subdomain keeps this traffic apart from whatever your main domain already sends.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy1s6bqghta7lep2zp31j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy1s6bqghta7lep2zp31j.png" alt="The Add your domain form with notify.example.com entered" width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The domain starts in onboarding, where sending is refused. Two steps take it to active: verify the domain, then create a credential for it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Let Auto Setup write the records on Cloudflare
&lt;/h2&gt;

&lt;p&gt;The domain page lists the records to publish, with an &lt;strong&gt;Auto Setup&lt;/strong&gt; button above them. Click it and mailkube sends you to Cloudflare in a new tab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe4xayq5w8nmmvveshwtj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe4xayq5w8nmmvveshwtj.png" alt="The Auto Setup dialog: you go to Cloudflare, approve the changes, and come back verified" width="800" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cloudflare shows the four records before anything is written:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1xzrobwfmemsq64w7qgt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1xzrobwfmemsq64w7qgt.png" alt="Cloudflare asking to authorize four DNS records from mailkube for notify.example.com" width="800" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Record&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TXT&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kube1._domainkey.notify&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;DKIM public key. mailkube generated the pair and keeps the private half.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TXT&lt;/td&gt;
&lt;td&gt;&lt;code&gt;_dmarc.notify&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;DMARC policy &lt;code&gt;p=none&lt;/code&gt;, with reports sent to mailkube. Failures get reported, nothing gets rejected.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MX&lt;/td&gt;
&lt;td&gt;&lt;code&gt;mkube-send.notify&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Return path. Bounces come back here.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TXT&lt;/td&gt;
&lt;td&gt;&lt;code&gt;mkube-send.notify&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;SPF, checked on the return path.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;SPF is checked on &lt;code&gt;mkube-send&lt;/code&gt;, the subdomain your mail is actually sent from, so the SPF record on your main domain stays exactly as it is. Adding a second sender usually means editing that record; here you don't. What each of the three records actually proves is a post of its own.&lt;/p&gt;

&lt;p&gt;The authorization is one-time and does not let mailkube change your zone later. It adds records and removes none. Click &lt;strong&gt;Authorize&lt;/strong&gt;, and you land back on the domain page while verification runs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fey7mgq98yjv068q3lovf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fey7mgq98yjv068q3lovf.png" alt="Your domain is verified" width="799" height="614"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your DNS lives somewhere else, copy each Host and Value from the domain page into your provider, then click &lt;strong&gt;Verify&lt;/strong&gt;. Verification keeps running in the background if you close the dialog, since propagation can take a few minutes.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create an API key
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;Credentials&lt;/strong&gt;, then &lt;strong&gt;API keys&lt;/strong&gt;, and create one. A key is bound to a single verified domain, and its secret is shown once.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft8ejh6ryoadaua49wrrd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft8ejh6ryoadaua49wrrd.png" alt="API key ready, with the secret shown once" width="800" height="805"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Put it in your environment, where both SDKs look for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAILKUBE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'mk_...'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Send your first email with curl
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST https://api.mailkube.com/mta/v1/emails \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $MAILKUBE_API_KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{
    "from": "Acme &amp;lt;hello@notify.example.com&amp;gt;",
    "to": "jordan@example.com",
    "subject": "Welcome to Acme",
    "html": "&amp;lt;h1&amp;gt;Welcome&amp;lt;/h1&amp;gt;&amp;lt;p&amp;gt;Your account is ready.&amp;lt;/p&amp;gt;"
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"3f9a7c21-5b6e-4d0a-9c8e-2b7f1e4d6a90"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"message_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;3f9a7c21-5b6e-4d0a-9c8e-2b7f1e4d6a90@msg.mailkube.com&amp;gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;200&lt;/code&gt; means the message is queued; delivery happens asynchronously. &lt;code&gt;id&lt;/code&gt; is mailkube's identifier, the one webhook events carry. &lt;code&gt;message_id&lt;/code&gt; is the RFC Message-ID header the recipient's copy will have.&lt;/p&gt;

&lt;h2&gt;
  
  
  Send it from Python
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install mailkube
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;mailkube&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Mailkube&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Mailkube&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# reads MAILKUBE_API_KEY&lt;/span&gt;

&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;from_&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Acme &amp;lt;hello@notify.example.com&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"jordan@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Welcome to Acme"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;h1&amp;gt;Welcome&amp;lt;/h1&amp;gt;&amp;lt;p&amp;gt;Your account is ready.&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Welcome\n\nYour account is ready."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parameter is &lt;code&gt;from_&lt;/code&gt; because &lt;code&gt;from&lt;/code&gt; is a Python keyword; the SDK sends it as &lt;code&gt;from&lt;/code&gt;. Passing both &lt;code&gt;html&lt;/code&gt; and &lt;code&gt;text&lt;/code&gt; gives clients that refuse HTML something to show.&lt;/p&gt;

&lt;h2&gt;
  
  
  Send it from Go
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go get github.com/mailkube/mailkube-go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"context"&lt;/span&gt;
    &lt;span class="s2"&gt;"errors"&lt;/span&gt;
    &lt;span class="s2"&gt;"log"&lt;/span&gt;

    &lt;span class="s2"&gt;"github.com/mailkube/mailkube-go"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;mailkube&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// reads MAILKUBE_API_KEY&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Emails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mailkube&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SendEmailParams&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;From&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;    &lt;span class="s2"&gt;"Acme &amp;lt;hello@notify.example.com&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;To&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;      &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"jordan@example.com"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;Subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Welcome to Acme"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="no"&gt;HTML&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;    &lt;span class="s2"&gt;"&amp;lt;h1&amp;gt;Welcome&amp;lt;/h1&amp;gt;&amp;lt;p&amp;gt;Your account is ready.&amp;lt;/p&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;apiErr&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;mailkube&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;APIError&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;As&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;apiErr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Fatalf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"%s: %s (request %s)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiErr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ErrorName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiErr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apiErr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RequestID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MessageID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Build the client once and share it: it is safe across goroutines. Log &lt;code&gt;RequestID&lt;/code&gt; on every failure, because it is the value support asks for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Find it in Logs
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;Logs&lt;/strong&gt; and click the row. The panel at the top of this post is what you get: &lt;strong&gt;Delivered&lt;/strong&gt;, and &lt;strong&gt;API&lt;/strong&gt; because the message came through the REST API (an SMTP send says SMTP). Auth is your key being checked, Reception is the message accepted for one recipient, and Delivery quotes the receiving server's reply word for word.&lt;/p&gt;

&lt;p&gt;Opens and clicks do not show up yet. Open and click tracking are per-domain settings, and both start off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Error&lt;/th&gt;
&lt;th&gt;Cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;403 invalid_api_key&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The key is missing, wrong, or limited to source IPs your machine is not on. mailkube reports every authentication problem under this one name on purpose.&lt;/td&gt;
&lt;td&gt;Check the key and its restrictions in Credentials.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;422 from_domain_not_allowed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The &lt;code&gt;from&lt;/code&gt; address is on a domain other than the one the key is bound to, such as &lt;code&gt;hello@example.com&lt;/code&gt; with a key for &lt;code&gt;notify.example.com&lt;/code&gt;.&lt;/td&gt;
&lt;td&gt;Send from the key's domain, or create a key for the other one.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;400 missing_user_agent&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A bare HTTP client sent no &lt;code&gt;User-Agent&lt;/code&gt;. curl and the SDKs always send one.&lt;/td&gt;
&lt;td&gt;Set a &lt;code&gt;User-Agent&lt;/code&gt; that names your integration.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;The message is delivered, but your app only knows it was queued. Delivery outcomes arrive as webhook events (&lt;code&gt;email.delivered&lt;/code&gt;, &lt;code&gt;email.bounced&lt;/code&gt; and the rest), and a receiver that checks their signatures is the next step. Until then, &lt;a href="https://docs.mailkube.com/docs/sending-your-first-email" rel="noopener noreferrer"&gt;Sending your first email&lt;/a&gt; in the docs covers attachments, custom headers and templates.&lt;/p&gt;

&lt;p&gt;How did you set up the DNS for your last sending domain: by hand, with Terraform, or through a provider's one-click flow?&lt;/p&gt;

</description>
      <category>email</category>
      <category>dns</category>
      <category>cloudflare</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
