Skip to content
GitHub Discord

AWS JSX Email

Uses JSX Email and the Email component to design and send emails.

To test this example, change the sst.config.ts to use your own email address.

sst.config.ts
sender: "email@example.com"

Then run.

Terminal window
npm install
npx sst dev

You’ll get an email from AWS asking you to confirm your email address. Click the link to verify it.

Next, go to the URL in the sst dev CLI output. You should now receive an email rendered using JSX Email.

index.ts
import { Template } from "./templates/email";
await render(Template({
email: "spongebob@example.com",
name: "Spongebob Squarepants"
}))

Once you are ready to go to production, you can:

sst.config.ts
const email = new sst.aws.Email("MyEmail", {
sender: "email@example.com",
});
const api = new sst.aws.Function("MyApi", {
handler: "index.handler",
link: [email],
url: true,
});

View the full example.