Node.js
Introduction
Learn how to send your first email using the Resend Node.js SDK.
Prerequisites
To get the most out of this guide, you’ll need to:
1. Install
Get the Resend Node.js SDK.
npm install resend
2. Send email using HTML
The easiest way to send an email is by using the html
parameter.
server.ts
import { Resend } from 'resend';
const resend = new Resend('re_123456789');
(async function () {
try {
const data = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'Hello World',
html: '<strong>It works!</strong>',
});
console.log(data);
} catch (error) {
console.error(error);
}
})();
3. Try it yourself
Node.js Example
See the full source code.