Documentation Index
Fetch the complete documentation index at: https://mintlify.com/revokslab/shipfree/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
ShipFree includes a flexible email system that supports multiple email providers with automatic fallback. The system is designed to:- Support multiple email providers (Resend, Postmark, Plunk, Nodemailer)
- Auto-discover configured providers based on environment variables
- Provide pre-built React Email templates for authentication flows
- Fall back gracefully when no provider is configured (logs to console)
- Allow easy switching between providers without code changes
Architecture
The email system consists of three main layers:1. Mailer Layer
The mailer provides the main API for sending emails:2. Provider Layer
Providers handle the actual email sending. ShipFree automatically uses the first configured provider based on this preference order:- Resend (recommended for production)
- Postmark
- Nodemailer (SMTP)
- Plunk
- Custom (user-defined)
- Log (fallback - logs to console)
EMAIL_PROVIDER environment variable:
3. Template Layer
Email templates are built with React Email, providing:- Type-safe React components
- Responsive HTML email generation
- Consistent branding across all emails
- Preview mode for development
Available Email Templates
ShipFree includes three pre-built authentication email templates:OTP Verification Email
Used for email verification, sign-in codes, and password reset verification. File:src/components/emails/auth/otp-verification-email.tsx
- Large, easy-to-read verification code
- Automatic expiration notice (15 minutes)
- Security warning not to share code
- Supports three types:
sign-in,email-verification,forget-password
Reset Password Email
Sends a password reset link to users. File:src/components/emails/auth/reset-password-email.tsx
- Prominent “Reset Password” button
- Personalized greeting
- Link expiration notice (24 hours)
- Security disclaimer
Welcome Email
Sent to new users after successful registration. File:src/components/emails/auth/welcome-email.tsx
- Friendly welcome message
- “Get Started” call-to-action button
- Personal touch from founder
- Encourages user engagement
Creating Custom Email Templates
You can create custom email templates using React Email:Step 1: Create a New Template
Create a new file insrc/components/emails/:
Step 2: Add a Render Function
Updatesrc/components/emails/render.ts:
Step 3: Add a Subject
Updatesrc/components/emails/subjects.ts:
Step 4: Send Your Email
Available Styling Components
ShipFree provides pre-styled components insrc/components/emails/_styles/:
- paragraph - Standard text styling
- button - Call-to-action button
- code - Monospace code display (great for OTP codes)
- codeContainer - Container for code blocks
- divider - Horizontal rule separator
- footerText - Smaller, muted text for disclaimers
- header - Email header section
- content - Main content wrapper
Email Layout Components
Use the shared layout components for consistency:EmailLayout
Wraps your email with HTML structure, logo, and footer:EmailFooter
Automatically included inEmailLayout with:
- Unsubscribe link (for marketing emails)
- Company address
- Brand information
Testing Emails in Development
ShipFree defaults to the log provider when no email service is configured, which:- Logs email details to the console
- Never sends actual emails
- Returns success immediately
- Perfect for development and testing
Preview with React Email Dev Server
ShipFree includes the React Email preview server:- Preview all email templates
- Test with different props
- View HTML and plain text versions
- Test responsiveness
Switching Between Providers
To switch email providers, simply update your environment variables:- Add new provider credentials (see provider-specific pages)
- Set EMAIL_PROVIDER (optional - auto-discovery works too)
- Restart your application
Checking Email Service Status
You can check if an email service is configured:Best Practices
Use environment-based configuration
Use environment-based configuration
Never hardcode email provider logic. Let environment variables control which provider is used.
Test with log provider first
Test with log provider first
Always test email flows with
EMAIL_PROVIDER=log before enabling real providers.Include both HTML and text versions
Include both HTML and text versions
While templates generate HTML, consider adding plain text alternatives for better deliverability:
Use batch sending for multiple emails
Use batch sending for multiple emails
When sending to multiple recipients, use
sendBatchEmails() for better performance:Handle email failures gracefully
Handle email failures gracefully
Always check the result of email sends:
Next Steps
Resend Setup
Configure Resend for production email delivery
Postmark Setup
Set up Postmark for transactional emails
Plunk Setup
Use Plunk for email campaigns
Nodemailer Setup
Configure SMTP with Nodemailer