Guides
Setup Plunk for Email
Configure Plunk to send transactional and marketing emails.
Overview
Plunk is a transactional email service that integrates seamlessly with BetterStarter. Use it for sending sign-in codes, password resets, and other transactional emails.
Prerequisites
- A Plunk account
- API key from Plunk dashboard
Environment Setup
- Get your API key from Plunk dashboard
- Add to
.env.local:
PLUNK_API_KEY=your_plunk_api_keyIntegration
BetterStarter uses Plunk in the email utilities. See src/lib/email.ts for the current implementation.
Sending Emails
import { sendEmail } from '@/lib/email'
await sendEmail({
to: 'user@example.com',
subject: 'Your Sign-In Code',
template: 'sign-in-code',
data: { code: '123456' }
})Customizing Email Templates
Templates are configured in your Plunk dashboard. Each template has:
- Unique identifier (slug)
- HTML and text versions
- Variable substitution via
{{variable}}
Common Templates
sign-in-code- Magic link / OTP sign-inpassword-reset- Password reset requestswelcome- New user welcome email
Testing
During development, use Plunk's test mode or check their webhook logs to verify emails are being sent correctly.
Production Considerations
- Ensure sender email is verified in Plunk
- Monitor delivery rates and bounces
- Set up webhook handlers for delivery tracking
- Test email templates across clients before going live