Email & Notifications
SaaSyBase includes 27 built-in email templates, a full in-app notification system, a support ticket system, and a contact page — all managed through the admin dashboard.
Email Template System
The app includes a database-backed email template CMS. Every email the app sends is rendered from a template that you can edit, test, and toggle on/off from the admin interface at /admin/emails.
Each template supports both HTML and plain text versions, activation toggles, test sends to verify rendering, and {{variable}} placeholders that are filled at send time.
Built-in templates (27 total)
| Template | When it's sent |
|---|---|
| welcome | User registers and verifies email |
| subscription_activated | Subscription becomes active |
| subscription_extended | Existing subscription is extended |
| subscription_upgraded | User upgrades from non-recurring to recurring plan |
| subscription_upgraded_recurring | User upgrades between recurring plans |
| subscription_upgrade_scheduled_recurring | Recurring upgrade scheduled for cycle end |
| subscription_change_scheduled_recurring | Plan change scheduled for cycle end |
| subscription_downgraded | User downgrades plan |
| subscription_cancelled | Subscription cancelled |
| subscription_expired | Subscription expired |
| subscription_ended | Subscription fully ended |
| subscription_renewed | Subscription renewed |
| subscription_renewal_reminder | Upcoming renewal reminder (Stripe invoice.upcoming) |
| token_topup | User purchases additional tokens/credits |
| tokens_credited | Admin credits tokens to a user |
| tokens_debited | Admin debits tokens from a user |
| admin_assigned_plan | Admin assigns a plan to a user |
| team_invitation | User is invited to join an organization |
| admin_notification | Admin billing alert emails |
| refund_issued | Refund processed for a payment |
| refund_processed | Refund confirmed by provider |
| payment_failed | Payment attempt failed |
| invoice_payment_failed | Invoice payment failed |
| password_reset | Password reset link (self-hosted auth lanes) |
| email_verification | Email verification link (self-hosted auth lanes) |
| email_change_confirmation | Email address change confirmation (self-hosted auth lanes) |
| magic_link | Magic link sign-in (Better Auth / NextAuth) |
Template variables
All templates support common variables that are injected automatically:
| Category | Variables |
|---|---|
| User | {{firstName}}, {{lastName}}, {{fullName}}, {{userEmail}} |
| Billing | {{planName}}, {{amount}}, {{transactionId}}, {{tokenAmount}} |
| Site | {{siteName}}, {{supportEmail}}, {{siteUrl}}, {{siteLogo}} |
| Branding | {{accentColor}}, {{accentHoverColor}} — resolved from theme palette |
| Links | {{dashboardUrl}}, {{billingUrl}} |
Unmatched placeholders are rendered as empty strings by the template renderer. Always send a realistic test email after editing a template so missing data does not silently collapse important copy or links.
Email delivery
The app supports two email providers, configured via the EMAIL_PROVIDER variable:
Tip
| Provider | Configuration |
|---|---|
| nodemailer (default) | Set SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS |
| resend | Set RESEND_API_KEY (SMTP variables are ignored) |
Official docs: Nodemailer docs and Resend docs.
Tip
If you are wiring auth-related emails too, pair this page with Authentication and Secrets & Providers.
Email logging
All sent emails are logged in the EmailLog model with recipient, subject, template key, and delivery status. This lets you audit email delivery from the admin dashboard.
In-App Notifications
The notification system provides in-app alerts with unread badges, URL deep-linking, and deduplication.
Notification types
| Type | Examples |
|---|---|
| BILLING | Subscription renewed, payment failed, refund processed |
| SUPPORT | Admin replied to your ticket |
| ACCOUNT | Profile updated, plan assigned |
| TEAM_INVITE | Invited to join a team |
| GENERAL | System announcements |
Features
- Unread badge counts — visible in the dashboard sidebar
- URL deep-linking — each notification can link to a specific page
- Deduplication — 5-minute window prevents duplicate notifications
- Admin alerts — configurable per-event admin emails (refund, purchase, renewal, upgrade, downgrade, payment failure, dispute)
- Global notifications — admins can broadcast to all users
Routes
| Type | Route | Purpose |
|---|---|---|
| User | /dashboard/notifications | View and mark notifications as read |
| Admin | /admin/notifications | Manage system notifications |
| API | /api/notifications | List notifications |
| API | /api/notifications/[id]/read | Mark single notification as read |
| API | /api/notifications/mark-all-read | Mark all as read |
Support Tickets
A built-in support ticket system for user-admin communication with reply threads and email notifications.
Note
How the support flow works
Users create tickets from /dashboard/support. Admins handle the queue in /admin/support, can change ticket status, and can reply directly into the thread. User replies and admin replies both flow through dedicated API endpoints, and each side can receive notification or email follow-up depending on your settings.
Features
- Ticket lifecycle: Open → replies → resolved
- Reply threads with messages from both users and admins
- Categories: General, Technical Support, Billing, Pre-Sale, Account, Feature Request
- Email notifications: Configurable for new tickets (to admin), admin replies (to user), and user replies (to admin)
- Dashboard badge: Users see a "NEW" badge when an admin has replied
The shipped support flow uses that predefined category set. If your product needs a different taxonomy, treat it as an intentional customization rather than assuming arbitrary freeform categories already exist.
Routes
| Type | Route | Purpose |
|---|---|---|
| User | /dashboard/support | Create tickets and view replies |
| Admin | /admin/support | View all open tickets, reply, manage status |
| API | /api/support/tickets | User ticket listing and creation |
| API | /api/support/tickets/[ticketId] | User ticket detail and status updates |
| API | /api/support/tickets/[ticketId]/reply | User replies in an existing thread |
| API | /api/admin/support/tickets | Admin ticket listing and creation |
| API | /api/admin/support/tickets/[ticketId]/reply | Admin replies to the user |
Contact Page
A public contact form at /contact backed by the /api/contact API route. The page content is managed as a site page — editable from /admin/pages.
Note
SUPPORT_EMAIL address. Make sure this is set in your environment or admin settings.For theming and editable contact-page content, see Content Management.

