Prerequisites
To get the most out of this guide, you’ll need to: If you prefer to watch a video, check out our video walkthrough below.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
4. Send email using HTML
Create an Astro Action underactions/index.ts
.
The easiest way to send an email is with the html
parameter.
send
action from any frontmatter route, script, or component.
5. Try it yourself
Astro Example
See the full source code.