Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/resend/resend-node
Resend's Official Node.js SDK
https://github.com/resend/resend-node
Last synced: 6 days ago
JSON representation
Resend's Official Node.js SDK
- Host: GitHub
- URL: https://github.com/resend/resend-node
- Owner: resend
- License: mit
- Created: 2022-07-31T04:38:52.000Z (over 2 years ago)
- Default Branch: canary
- Last Pushed: 2025-02-13T08:26:38.000Z (8 days ago)
- Last Synced: 2025-02-13T18:46:49.744Z (8 days ago)
- Language: TypeScript
- Homepage:
- Size: 36.7 MB
- Stars: 622
- Watchers: 4
- Forks: 44
- Open Issues: 53
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Resend Node.js SDK
Node.js library for the Resend API.
## Install
```bash
npm install resend
# or
yarn add resend
```## Examples
Send email with:
- [Node.js](https://github.com/resendlabs/resend-node-example)
- [Next.js (App Router)](https://github.com/resendlabs/resend-nextjs-app-router-example)
- [Next.js (Pages Router)](https://github.com/resendlabs/resend-nextjs-pages-router-example)
- [Express](https://github.com/resendlabs/resend-express-example)## Setup
First, you need to get an API key, which is available in the [Resend Dashboard](https://resend.com).
```js
import { Resend } from 'resend';
const resend = new Resend('re_123456789');
```## Usage
Send your first email:
```js
await resend.emails.send({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'hello world',
text: 'it works!',
});
```## Send email using HTML
Send an email custom HTML content:
```js
await resend.emails.send({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'hello world',
html: 'it works!',
});
```## Send email using React
Start by creating your email template as a React component.
```jsx
import React from 'react';export default function EmailTemplate({ firstName, product }) {
return (
Welcome, {firstName}!
Thanks for trying {product}. We’re thrilled to have you on board.
);
}
```Then import the template component and pass it to the `react` property.
```jsx
import EmailTemplate from '../components/EmailTemplate';await resend.emails.send({
from: '[email protected]',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'hello world',
react: ,
});
```## License
MIT License