SaaSyBase
SaaSyBase

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)

TemplateWhen it's sent
welcomeUser registers and verifies email
subscription_activatedSubscription becomes active
subscription_extendedExisting subscription is extended
subscription_upgradedUser upgrades from non-recurring to recurring plan
subscription_upgraded_recurringUser upgrades between recurring plans
subscription_upgrade_scheduled_recurringRecurring upgrade scheduled for cycle end
subscription_change_scheduled_recurringPlan change scheduled for cycle end
subscription_downgradedUser downgrades plan
subscription_cancelledSubscription cancelled
subscription_expiredSubscription expired
subscription_endedSubscription fully ended
subscription_renewedSubscription renewed
subscription_renewal_reminderUpcoming renewal reminder (Stripe invoice.upcoming)
token_topupUser purchases additional tokens/credits
tokens_creditedAdmin credits tokens to a user
tokens_debitedAdmin debits tokens from a user
admin_assigned_planAdmin assigns a plan to a user
team_invitationUser is invited to join an organization
admin_notificationAdmin billing alert emails
refund_issuedRefund processed for a payment
refund_processedRefund confirmed by provider
payment_failedPayment attempt failed
invoice_payment_failedInvoice payment failed
password_resetPassword reset link (self-hosted auth lanes)
email_verificationEmail verification link (self-hosted auth lanes)
email_change_confirmationEmail address change confirmation (self-hosted auth lanes)
magic_linkMagic link sign-in (Better Auth / NextAuth)

Template variables

All templates support common variables that are injected automatically:

CategoryVariables
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

Choose Nodemailer when you want SMTP portability or local MailHog testing. Choose Resend when you want a simpler hosted transactional email API and already use their service.
ProviderConfiguration
nodemailer (default)Set SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS
resendSet RESEND_API_KEY (SMTP variables are ignored)

Official docs: Nodemailer docs and Resend docs.

Tip

In local development, the default SMTP values can point at MailHog (localhost:1025) for easy email testing without sending real emails.

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

TypeExamples
BILLINGSubscription renewed, payment failed, refund processed
SUPPORTAdmin replied to your ticket
ACCOUNTProfile updated, plan assigned
TEAM_INVITEInvited to join a team
GENERALSystem 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

TypeRoutePurpose
User/dashboard/notificationsView and mark notifications as read
Admin/admin/notificationsManage system notifications
API/api/notificationsList notifications
API/api/notifications/[id]/readMark single notification as read
API/api/notifications/mark-all-readMark all as read

Support Tickets

A built-in support ticket system for user-admin communication with reply threads and email notifications.

Note

Choose the built-in ticket flow when you want support to stay inside the app and admin dashboard. If your team already runs an external helpdesk, keep this minimal and use the public contact form plus notifications as the lightweight path.

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

TypeRoutePurpose
User/dashboard/supportCreate tickets and view replies
Admin/admin/supportView all open tickets, reply, manage status
API/api/support/ticketsUser ticket listing and creation
API/api/support/tickets/[ticketId]User ticket detail and status updates
API/api/support/tickets/[ticketId]/replyUser replies in an existing thread
API/api/admin/support/ticketsAdmin ticket listing and creation
API/api/admin/support/tickets/[ticketId]/replyAdmin 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

Contact form submissions are delivered to the SUPPORT_EMAIL address. Make sure this is set in your environment or admin settings.

For theming and editable contact-page content, see Content Management.