Emails with Resend
Send beautiful transactional emails with Resend.
Alternative Email Service
If you want to use Mailgun instead of Resend, check out our Mailgun documentation.
This SaaS boilerplate uses Resend to send beautiful, responsive transactional emails. Resend provides a simple API for sending emails and includes features like open tracking, click tracking, and bounce handling.
Email Features
- Beautiful, responsive email templates
- Open and click tracking
- Bounce handling and delivery reports
- Domain verification for better deliverability
Resend Setup
Step 1: Create a Resend Account
Sign up at resend, if you don't already have a Resend account.
Step 2: Get Your API Key
Once you've created your account, get your API key:
- Go to the API Keys page in your Resend dashboard
- Click "Create API Key"
- Copy the API key
Step 3: Add API Key to Environment Variables
Add your Resend API key to your .env
file :
EMAIL_API_KEY="re_..."EMAIL_FROM="Your Name <onboarding@resend.dev>"EMAIL_SERVER_USER="resend"EMAIL_SERVER_HOST="smtp.resend.com"EMAIL_SERVER_PORT="465"
Email Sender
For the EMAIL_FROM
environment variable, you can use the default onboarding@resend.dev
email during development. For production, you'll need to verify your domain.
Domain Verification
Step 1: Add Your Domain
- Go to the Domains page in your Resend dashboard
- Click "Add Domain"
- Enter your domain name.
- Follow the instructions to add the required DNS records.
- Wait for the verification to complete (this may take a few minutes to a few hours)
Step 2: Update Your Email From Address
Once your domain is verified, update your EMAIL_FROM environment variable:
EMAIL_FROM="Your Name <subdomain@resenddomain>"
In the subdomain, you can add your subdomain e.g. your name, update, verify, no-reply etc.
Email setup on your app
Files to check
- Magic Link setup
lib/auth.ts
- Login and signup page
app/login/page.tsx