Prerequisites

To get the most out of this guide, you’ll need to:

1. Install

Install Resend for Node.js.

2. Install an SSR adapter

Because Astro builds a static site by default, install an SSR adapter to enable on-demand rendering of routes.

3. Add your API key

Create an API key in Resend and add it to your .env file to keep your API key secret.

.env
RESEND_API_KEY="re_123456789"

4. Send email using HTML

Create an Astro Action under actions/index.ts.

The easiest way to send an email is with the html parameter.

Call the send action from any frontmatter route, script, or component.

5. Try it yourself

Astro Example

See the full source code.