What you'll build
An automatic email sending system that notifies your users when they register, make a purchase, or any important event in your application. You'll use Resend (or SendGrid) to send personalized HTML emails with your brand, including templates created with React Email that you can preview before sending. When finished, you'll have reusable functions to send different types of transactional emails from anywhere in your backend.
Recommended services
| Service | Free | Ideal for |
|---|---|---|
| Resend | 3000/month | Developers |
| SendGrid | 100/day | Enterprise |
| Postmark | 100/month | Transactional |
Resend Setup
pnpm add resend
Code
import { Resend } from 'resend'
const resend = new Resend(process.env.RESEND_API_KEY)
export async function sendWelcomeEmail(to: string, name: string) {
await resend.emails.send({
from: 'Your App <noreply@yourdomain.com>',
to,
subject: 'Welcome!',
html: `
<h1>Hello ${name}!</h1>
<p>Thanks for signing up.</p>
`
})
}
With React Email
import { render } from '@react-email/render'
import WelcomeEmail from './emails/Welcome'
const html = render(<WelcomeEmail name={name} />)
await resend.emails.send({ ..., html })