Package Exports
- resend
- resend/build/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (resend) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Resend Node.js SDK
Node.js library for the Resend API.
Install
npm install resend
# or
yarn add resendExamples
Send email with:
Setup
First, you need to get an API key, which is available in the Resend Dashboard.
import { Resend } from 'resend';
const resend = new Resend('re_123456789');Usage
Send your first email:
await resend.emails.send({
from: 'you@example.com',
to: 'user@gmail.com',
subject: 'hello world',
text: 'it works!',
});Send email using HTML
Send an email custom HTML content:
await resend.emails.send({
from: 'you@example.com',
to: 'user@gmail.com',
subject: 'hello world',
html: '<strong>it works!</strong>',
});Send email using React
Start by creating your email template as a React component.
import React from 'react'
export default function EmailTemplate(props) {
const { firstName, product } = props
return (
<div>
<h1>Welcome, {firstName}!</h1>
<p>Thanks for trying {product}. We’re thrilled to have you on board.</p>
</div>
)
}Then import the template component and pass it to the react property.
import EmailTemplate from '../components/EmailTemplate'
await resend.emails.send({
from: 'you@example.com',
to: 'user@gmail.com',
subject: 'hello world',
react: <EmailTemplate firstName="John" product="MyApp" />,
});License
MIT License