Skip to main content
This guide walks through implementing emails in your app end to end: connect a server, brand your mail, create a template, send from your backend, then watch delivery. For a quick “can I do this?” checklist, see the Emails overview. You’ll need Hexclave set up with a server app (hexclaveServerApp). If you don’t have that yet, follow Setup first, then enable Emails in the dashboard.

1. Connect an email server

Open Emails → Email Settings in the dashboard. Hexclave needs somewhere to send from. While developing, leave Shared selected. Built-in auth mail (verification, password reset, magic link) already works. Custom sendEmail calls also go out on shared — Hexclave wraps them as “dev emails” so recipients know they aren’t from your domain yet. A development environment can only use Shared. Configure the other providers in the cloud dashboard. Before production, switch to one of: Saving a custom provider triggers a test email from the dashboard so you know the config works.

2. Pick transactional vs marketing

Every send is one of two categories:
  • Transactional — required for the product (verification, receipts, password reset). Users cannot opt out.
  • Marketing — promotional or informational. Users can unsubscribe; Hexclave appends an unsubscribe link.
Never send marketing content as transactional mail. That can get your domain blacklisted.
Set the category when you send (notificationCategoryName) or inside the template / draft with <NotificationCategory>. If you omit it everywhere, the category stays undefined and unsubscribe preferences are not applied — prefer setting it explicitly.

3. Brand with a theme

Themes wrap every email (header, footer, logo, background). Hexclave ships Default Light, Default Dark, and Default Colorful. Set a project default under Emails → Email Settings → Themes, or skip this step and use the default. To author your own theme as TSX:
Per-send overrides: themeId: "your-theme-id", themeId: null for the project default, or themeId: false for no theme. Full theme API: Templates & themes.

4. Create a template

Built-in templates already cover verification, password reset, magic link, invitations, payment receipts, payment failures, and trial-ending notices — Hexclave sends those automatically when those flows run. Customize them under Emails → Templates. For your own product email, create a React Email template in the dashboard (or start from a clone). A minimal template looks like this:
  • variablesSchema validates the variables you pass at send time.
  • <Subject> and <NotificationCategory> live in the template so the content owns its subject and category.
  • Saving custom templates on Shared requires a custom email server; you can still edit and preview.
Don’t want a reusable template yet? You can send raw html in the next step, or compose a Draft in the dashboard instead.

5. Send your first email

From your server, call hexclaveServerApp.sendEmail(). Exactly one recipient selector and exactly one content source are required. HTML (fastest smoke test):
Template with variables:
Everyone in the project:
Dashboard draft:

Options reference

sendEmail resolves to void and throws on failure. Branch on stable errorCode values when present:
Unknown templateId or draftId values fail the request immediately (HTTP 400) — nothing is enqueued. Those errors typically have no errorCode in the switch above, so they fall through to default.

6. Schedule a send (optional)

Pass scheduledAt to enqueue now and deliver later. Omit it to send as soon as the pipeline allows.

7. Watch delivery

After sendEmail returns, the message shows up under Emails → Sent with a status such as Preparing, Rendering, Scheduled, Queued, Sending, Sent, Skipped, Render Error, or Server Error. Under the hood, Hexclave enqueues, renders, queues (respecting capacity and scheduledAt), sends (honoring unsubscribes), and tracks delivery. From code:
Stats cover hour, day, week, and month windows for sent, bounced, and marked as spam. If you need a short-term throughput increase, call it from your server:
Or increase capacity from the dashboard: open Emails → Sent, find the Domain Reputation card, and click Temporarily increase capacity. A boost raises hourly capacity for a limited time (about 4× for 4 hours). It still counts against your overall monthly sending capacity.

8. Optional: compose without a code template

For one-off or campaign mail, open Emails → Drafts, create a blank draft or clone a template, edit with live preview, pick a theme and recipients, then send from the UI or with draftId. Details: Drafts.

What you should have now

  1. An email server (Shared for development, custom for production)
  2. A theme (built-in or your own)
  3. A template, HTML body, or draft
  4. At least one successful sendEmail from your backend
  5. Visibility into delivery in Emails → Sent / getEmailDeliveryStats
Built-in auth and payment emails continue to send automatically when those flows run — you only call sendEmail for your own product mail.