<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Resend on IAMDevBox</title><link>https://www.iamdevbox.com/tags/resend/</link><description>Recent content in Resend on IAMDevBox</description><image><title>IAMDevBox</title><url>https://www.iamdevbox.com/IAMDevBox.com.jpg</url><link>https://www.iamdevbox.com/IAMDevBox.com.jpg</link></image><generator>Hugo -- 0.146.0</generator><language>en-us</language><lastBuildDate>Sun, 10 May 2026 14:57:53 +0000</lastBuildDate><atom:link href="https://www.iamdevbox.com/tags/resend/index.xml" rel="self" type="application/rss+xml"/><item><title>Integrating Resend with Auth0 for Email Delivery</title><link>https://www.iamdevbox.com/posts/integrating-resend-with-auth0-for-email-delivery/</link><pubDate>Sun, 10 May 2026 14:51:14 +0000</pubDate><guid>https://www.iamdevbox.com/posts/integrating-resend-with-auth0-for-email-delivery/</guid><description>Integrating Resend with Auth0 for email delivery streamlines your email processes and enhances security. Learn how to set it up quickly and customize your email templates with Liquid and React Email.</description><content:encoded><![CDATA[<p><strong>Why This Matters Now</strong>: With the increasing emphasis on user experience and security in digital platforms, integrating Resend with Auth0 provides a seamless and secure way to handle email delivery. The recent surge in email-related vulnerabilities underscores the importance of robust email infrastructure. As of March 2024, Resend has been integrated into Auth0, offering developers a powerful tool to enhance their email workflows.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>Before diving into the integration process, ensure you have the following set up in your Resend account:</p>
<h3 id="domain-verification">Domain Verification</h3>
<ol>
<li><strong>Add Your Sending Domain</strong>: Go to the Resend dashboard and add your sending domain.</li>
<li><strong>Configure DNS Records</strong>: Follow the instructions provided by Resend to set up SPF, DKIM, and DMARC records. This ensures your emails are authenticated and less likely to be marked as spam.</li>
</ol>
<h3 id="api-key">API Key</h3>
<ol>
<li><strong>Generate an API Key</strong>: Navigate to the Resend dashboard, go to the API Keys section, and generate a new API key. This key will serve as both your SMTP password and a secret for Auth0 Actions.</li>
</ol>
<h2 id="configuring-resend-as-an-email-provider">Configuring Resend as an Email Provider</h2>
<h3 id="option-1-basic-configuration">Option 1: Basic Configuration</h3>
<p>For a quick setup, follow these steps to integrate Resend as your email provider in Auth0.</p>
<h4 id="dashboard-configuration">Dashboard Configuration</h4>
<ol>
<li>
<p><strong>Navigate to Email Provider Settings</strong>:</p>
<ul>
<li>Go to your Auth0 Dashboard.</li>
<li>Head to <code>Branding &gt; Email Provider</code>.</li>
</ul>
</li>
<li>
<p><strong>Enable Custom Email Provider</strong>:</p>
<ul>
<li>Toggle on <code>Use my own email provider</code>.</li>
<li>Select <code>Resend</code>.</li>
</ul>
</li>
<li>
<p><strong>Enter Resend Credentials</strong>:</p>
<ul>
<li>Fill in the <code>API Key</code> field with your Resend API key.</li>
<li>Set the <code>From</code> address to match the domain you verified in Resend.</li>
</ul>
</li>
<li>
<p><strong>Test the Configuration</strong>:</p>
<ul>
<li>Click <code>Send Test Email</code> to verify the setup.</li>
<li>Check your inbox and the Resend dashboard for the test email.</li>
</ul>
</li>
</ol>
<div class="notice success">✅ <strong>Best Practice:</strong> Always test your email configuration to ensure emails are delivered correctly.</div>
<h4 id="troubleshooting-common-issues">Troubleshooting Common Issues</h4>
<ul>
<li><strong>SMTP Errors</strong>: Check Auth0 Logs for SMTP errors. Common issues include port blocking (avoid port 25) and DNS propagation delays on newly verified domains.</li>
</ul>
<div class="key-takeaway">
<h4>🎯 Key Takeaways</h4>
<ul>
<li>Quickly configure Resend as your email provider in Auth0.</li>
<li>Ensure domain verification and correct API key usage.</li>
<li>Test your configuration to avoid delivery issues.</li>
</ul>
</div>
<h3 id="option-2-using-auth0-actions-with-the-resend-sdk">Option 2: Using Auth0 Actions with the Resend SDK</h3>
<p>For more control and customization, use Auth0 Actions with the Resend SDK.</p>
<h4 id="writing-the-action">Writing the Action</h4>
<ol>
<li>
<p><strong>Create a New Action</strong>:</p>
<ul>
<li>Go to <code>Actions &gt; Library</code>.</li>
<li>Click <code>Create Action</code> and choose <code>Custom</code>.</li>
<li>Enter a name and select a trigger (e.g., Post Login).</li>
</ul>
</li>
<li>
<p><strong>Add Dependencies</strong>:</p>
<ul>
<li>In the left icons panel, click <code>Dependencies</code>.</li>
<li>Click <code>Add Dependency</code> and type <code>resend</code>, then click <code>Add</code>.</li>
</ul>
</li>
<li>
<p><strong>Add Secrets</strong>:</p>
<ul>
<li>Click <code>Secrets</code> and add your Resend API key as <code>RESEND_API_KEY</code>.</li>
</ul>
</li>
<li>
<p><strong>Write the Code</strong>:</p>
<ul>
<li>Use the following example code to send an email on user login:</li>
</ul>
</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-javascript" data-lang="javascript"><span style="display:flex;"><span><span style="color:#66d9ef">const</span> { <span style="color:#a6e22e">Resend</span> } <span style="color:#f92672">=</span> <span style="color:#a6e22e">require</span>(<span style="color:#e6db74">&#39;resend&#39;</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">exports</span>.<span style="color:#a6e22e">onExecutePostLogin</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">async</span> (<span style="color:#a6e22e">event</span>, <span style="color:#a6e22e">api</span>) =&gt; {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">const</span> <span style="color:#a6e22e">resend</span> <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> <span style="color:#a6e22e">Resend</span>(<span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">secrets</span>.<span style="color:#a6e22e">RESEND_API_KEY</span>);
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> (<span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">stats</span>.<span style="color:#a6e22e">logins_count</span> <span style="color:#f92672">===</span> <span style="color:#ae81ff">1</span>) {
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">try</span> {
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">await</span> <span style="color:#a6e22e">resend</span>.<span style="color:#a6e22e">emails</span>.<span style="color:#a6e22e">send</span>({
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">from</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;Security &lt;security@your_domain.com&gt;&#39;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">to</span><span style="color:#f92672">:</span> <span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">user</span>.<span style="color:#a6e22e">email</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">subject</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;New login detected&#39;</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">html</span><span style="color:#f92672">:</span> <span style="color:#e6db74">`
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">                    &lt;div style=&#34;font-family: sans-serif; padding: 20px;&#34;&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">                        &lt;h2&gt;Security Alert&lt;/h2&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">                        &lt;p&gt;Hi </span><span style="color:#e6db74">${</span><span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">user</span>.<span style="color:#a6e22e">name</span> <span style="color:#f92672">||</span> <span style="color:#e6db74">&#39;there&#39;</span><span style="color:#e6db74">}</span><span style="color:#e6db74">,&lt;/p&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">                        &lt;p&gt;New login from IP: </span><span style="color:#e6db74">${</span><span style="color:#a6e22e">event</span>.<span style="color:#a6e22e">request</span>.<span style="color:#a6e22e">ip</span><span style="color:#e6db74">}</span><span style="color:#e6db74">&lt;/p&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">                        &lt;p&gt;Not you? Reset your password.&lt;/p&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">                    &lt;/div&gt;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">                `</span>,
</span></span><span style="display:flex;"><span>                <span style="color:#a6e22e">tags</span><span style="color:#f92672">:</span> [{ <span style="color:#a6e22e">name</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;category&#39;</span>, <span style="color:#a6e22e">value</span><span style="color:#f92672">:</span> <span style="color:#e6db74">&#39;security_alert&#39;</span> }],
</span></span><span style="display:flex;"><span>            });
</span></span><span style="display:flex;"><span>        } <span style="color:#66d9ef">catch</span> (<span style="color:#a6e22e">error</span>) {
</span></span><span style="display:flex;"><span>            <span style="color:#a6e22e">console</span>.<span style="color:#a6e22e">error</span>(<span style="color:#e6db74">&#39;Resend failed:&#39;</span>, <span style="color:#a6e22e">error</span>);
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><ol start="5">
<li><strong>Deploy the Action</strong>:
<ul>
<li>Go to <code>Actions &gt; Triggers</code>.</li>
<li>Select the <code>Post Login</code> trigger.</li>
<li>Drag your custom action into the flow and click <code>Deploy</code>.</li>
</ul>
</li>
</ol>
<div class="notice tip">💜 <strong>Pro Tip:</strong> Customize the email content and triggers based on your specific requirements.</div>
<h4 id="customizing-email-templates-with-liquid-and-resends-react-email">Customizing Email Templates with Liquid and Resend’s React Email</h4>
<p>Auth0 uses Liquid syntax for dynamic variables in email templates. You can edit these templates directly in the Auth0 Dashboard under <code>Branding &gt; Email Templates</code>.</p>
<ol>
<li>
<p><strong>Edit Templates</strong>:</p>
<ul>
<li>Open the template you want to modify.</li>
<li>Use Liquid syntax for dynamic content (e.g., <code>{{ user.email }}</code>, <code>{{ url }}</code>).</li>
</ul>
</li>
<li>
<p><strong>Using React Email</strong>:</p>
<ul>
<li>Resend supports React Email components for building modern email templates.</li>
<li>Integrate React Email components into your Auth0 templates for enhanced design and functionality.</li>
</ul>
</li>
</ol>
<div class="key-takeaway">
<h4>🎯 Key Takeaways</h4>
<ul>
<li>Gain full programmatic control with Auth0 Actions and Resend SDK.</li>
<li>Customize email content and triggers based on user actions.</li>
<li>Enhance email design with React Email components.</li>
</ul>
</div>
<h2 id="conclusion">Conclusion</h2>
<p>Integrating Resend with Auth0 offers a robust solution for email delivery, combining ease of use with advanced customization options. By following the steps outlined above, you can ensure your emails are delivered efficiently and securely, enhancing both user experience and security.</p>
<div class="notice info">💡 <strong>Key Point:</strong> Regularly review and update your email configurations to maintain high deliverability and security standards.</div>]]></content:encoded></item></channel></rss>