Setup Resend
Configure Resend for transactional emails with custom domain verification.
Environment Variables
| Variable | Description | Type | Source |
|---|---|---|---|
RESEND_API_KEY | Resend API key for sending emails* | server secret | Resend Dashboard → API Keys |
RESEND_FROM_EMAIL | Default sender email address* | server safe | Your verified domain email |
RESEND_REPLY_TO | Default reply-to email address | server safe | Your support email |
* Required variable
Step 1: Get API Key
- Go to Resend Dashboard → API Keys
- Click "Create API Key"
- Give it a name (e.g., "Production")
- Select permissions (Full access for simplicity, or restricted for security)
- Copy the API key (starts with
re_)
Save Your API Key
You'll only see the API key once. Save it securely before closing the dialog.
Step 2: Verify Domain (Recommended)
For better deliverability, verify your domain:
- Go to Resend Dashboard → Domains
- Click "Add Domain"
- Enter your domain (e.g.,
yourdomain.com) - Add the DNS records shown to your domain registrar
- Wait for verification (usually a few minutes)
Development Without Domain
For development, you can send emails from
onboarding@resend.devwithout domain verification. Production apps should use a verified domain.Step 3: Add to .env.local
.env.local
# Email Configuration (Resend)
RESEND_API_KEY=re_xxxxx
RESEND_FROM_EMAIL=noreply@yourdomain.com
RESEND_REPLY_TO=support@yourdomain.comStep 4: Test Email Sending
Test your configuration with a simple API call:
Example usage
// Example: Send a test email
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
await resend.emails.send({
from: process.env.RESEND_FROM_EMAIL,
to: 'test@example.com',
subject: 'Hello from VibeCodeMax',
html: '<p>Your email setup is working!</p>',
});Troubleshooting
"API key invalid"
Double-check your API key. Make sure there are no extra spaces or characters.
"Domain not verified"
DNS propagation can take up to 48 hours. Check your DNS records are correctly configured.
"Email going to spam"
Verify your domain and set up DKIM/SPF records for better deliverability.
