Skip to main content
BunShip uses React Email for templating and Resend for delivery. Templates live in the packages/emails/ package and render to HTML that works across all major email clients.

Email Package Overview

Emails are sent through a BullMQ background job queue, so sending never blocks API responses.

Available Templates

BunShip ships with six templates that cover the core SaaS transactional email flows.

Welcome Email

Sent after a user registers. Includes a link to the dashboard.

Verify Email

Sent to confirm an email address. Includes a verification link and a resend option.

Reset Password

Sent when a user requests a password reset.

Team Invite

Sent when a team member is invited to join an organization.

Invoice

Sent after a successful payment.

Subscription Canceled

Sent when a user cancels their subscription.

Template Structure

Every template follows the same pattern: a props interface, a React component, and inline styles.

The Layout Component

All built-in templates use a shared Layout component that provides consistent branding, a header with your logo, and a footer with your company details.
Edit packages/emails/src/components/Layout.tsx to change:
  • Brand logo URL and dimensions
  • Header background color
  • Footer text and links
  • Default font family

Creating a Custom Template

1

Create the template file

Add a new file in packages/emails/src/templates/:
2

Export from the package

Add the export to packages/emails/src/index.ts:
3

Send the email from your API

Use the email queue to send asynchronously:

Rendering Emails

The @bunship/emails package exports two render functions:

HTML Rendering

Plain Text Rendering

For email clients that do not support HTML:

Sending with Resend

BunShip sends emails through Resend via the background job queue. The queue is configured in featuresConfig.jobs.queues.email:
Always use the queue for sending emails from API route handlers. This keeps response times fast and handles retries automatically if the email provider is temporarily unavailable.

Testing Emails Locally

React Email includes a development server that renders your templates in the browser with hot reload.
This starts a preview server at http://localhost:3000 where you can:
  • Browse all templates in a sidebar
  • Preview with sample data
  • Toggle between desktop and mobile widths
  • View the raw HTML output

Sending Test Emails

To send a real test email through Resend (requires a valid API key):

Styling Guidelines

Email clients have limited and inconsistent CSS support. Follow these rules for reliable rendering:
Email clients strip <style> tags and ignore external stylesheets. Define styles as JavaScript objects and apply them via the style prop.
Use system font stacks that work everywhere:
Avoid complex CSS layouts (flexbox, grid). Use React Email’s <Section>, <Row>, and <Column> components for multi-column layouts.
The built-in templates are tested across Gmail, Outlook, Apple Mail, Yahoo Mail, and Thunderbird. Test your custom templates in the same clients before deploying.

Next Steps

Adding Routes

Trigger your new emails from API endpoints

OAuth Providers

Add social login to your authentication flow