Backend
Emails
Resend, email service, and templates.
Overview
NextBento uses Resend for transactional emails. Emails are sent via lib/email/service.ts using React Email components.
Service
lib/email/service.ts:
sendEmail()— Generic send with React component- Renders React to HTML via
@react-email/render - Plain text fallback for deliverability
- Idempotency key support
- Tags for analytics
Templates
| Template | File | Use Case |
|---|---|---|
| Billing: Payment Success | billing-payment-success.tsx | After successful payment |
| Billing: Payment Failed | billing-payment-failed.tsx | Payment failure notification |
| Billing: Subscription Updated | billing-subscription-updated.tsx | Plan change, cancel, etc. |
| Team Invitation | team-invitation.tsx | Invite team member |
| Feedback Submission | feedback-submission.tsx | User feedback received |
| Feedback Confirmation | feedback-confirmation.tsx | Thank-you after feedback |
Templates live in components/emails/.
Configuration
RESEND_TOKEN— Resend API key (required)FROM_EMAIL— Sender (e.g.NextBento <noreply@yourdomain.com>)REPLY_TO_EMAIL— Reply-to addressNEXT_PUBLIC_APP_URL— Base URL for links
Adding a Template
- Create
components/emails/my-email.tsxusing React Email - Import and call
sendEmail({ to, subject, react: <MyEmail /> })from your API or server action
Best Practices
- Use Resend domain verification for better deliverability
- Set up SPF/DKIM/DMARC (see Resend Domain Verification)
- Keep subject lines clear and non-spammy
- Include plain text fallback