Integrating Resend for Transactional Emails
Integrando Resend para Correos Transaccionales
Introduction
Resend is a modern email API for developers. It provides a clean and easy-to-use interface for sending transactional emails. In this guide, we’ll walk through setting up Resend in a Node.js project.
Prerequisites
- A Resend account
- Node.js installed
- An API Key from the Resend dashboard
Step 1: Installation
First, install the Resend SDK:
npm install resend
Step 2: Sending an Email
Create a file named send-email.js and add the following code:
import { Resend } from 'resend';
const resend = new Resend('re_123456789');
(async function() {
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'Hello World',
html: '<strong>It works!</strong>',
});
if (error) {
return console.error({ error });
}
console.log({ data });
})();
Conclusion
Resend simplifies the process of sending emails with a developer-first approach.