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

import { Resent } from "resent.one";
export const handler = async () => {
const resent = new Resent(process.env.RESENT_API_KEY);
const result = await resent.emails.send({
from: "Acme <noreply@yourdomain.com>",
to: "you@example.com",
subject: "Hello from AWS Lambda",
html: "<strong>It works!</strong>",
});
return {
statusCode: 200,
body: JSON.stringify(result),
};
};

Next steps