AWS Lambda

Send email from AWS Lambda handlers.

Send email from AWS Lambda handlers.

Install

$npm i resent.one

Set RESENT_API_KEY in your server environment. Keep the key off the client.

Send an email

1import { Resent } from "resent.one";
2
3export const handler = async () => {
4 const resent = new Resent(process.env.RESENT_API_KEY);
5 const result = await resent.emails.send({
6 from: "Acme <noreply@yourdomain.com>",
7 to: "you@example.com",
8 subject: "Hello from AWS Lambda",
9 html: "<strong>It works!</strong>",
10 });
11 return {
12 statusCode: 200,
13 body: JSON.stringify(result),
14 };
15};

Next steps