Email types
There are two categories of email:- Transactional - Required for your app to function (verification, password reset, receipts). Users cannot opt out.
- Marketing - Promotional or informational. Always includes an unsubscribe link. Users can opt out.
Sending emails
Emails are sent from your server usinghexclaveServerApp.sendEmail(). You must provide the content (HTML, a template, or a draft) and the recipients.
Send to specific users
Send to all users
Send from a dashboard draft
If you’ve composed an email in the dashboard’s draft editor, you can trigger it programmatically:Full options
SendEmailOptions type shape
sendEmail requires a custom email server (SMTP, Resend, or Managed). It cannot be used with the shared development server.Error handling
sendEmail returns a result object. Handle failures explicitly:
Scheduling
Pass ascheduledAt date to delay delivery. The email enters the pipeline immediately but won’t be sent until the scheduled time.
scheduledAt is omitted, the email is sent as soon as possible.
Email pipeline
Emails are processed asynchronously through a multi-stage pipeline:- Enqueue - The email is saved to the outbox with its template, recipients, and scheduling metadata.
- Render - The template TSX is compiled into HTML, subject, and plain text.
- Queue - Rendered emails whose scheduled time has passed are queued for delivery, respecting your project’s sending capacity.
- Send - Emails are delivered, honoring notification preferences and skipping users who have unsubscribed.
- Track - Delivery events (sent, opened, clicked, bounced, marked as spam) are recorded.
Templates
Templates are React Email components written in TSX. Each template receives the currentuser, project, and any custom variables you pass when sending.
variablesSchema- Define the shape of your template variables using arktype. Hexclave validates variables against this schema at render time.<Subject>- Sets the email subject line from inside the template.<NotificationCategory>- Declares whether this is a"Transactional"or"Marketing"email.PreviewVariables- Sample data used for the live preview in the dashboard editor.
Built-in templates
Hexclave ships with templates for common auth flows. These are used automatically by the built-in authentication components:
You can customize any built-in template from the dashboard under Emails → Templates.
Themes
Themes wrap your email content in a consistent layout - header, footer, background, branding. Hexclave includes three built-in themes:- Default Light - Clean white background with subtle shadow
- Default Dark - Dark background with light text
- Default Colorful - Light purple background with an accent border
themeId option, or pass themeId: false to send without any theme.
Notification preferences
Emails are categorized as either Transactional or Marketing. Users can opt out of Marketing emails but not Transactional ones. When sending, specify the category:React components integration
Emails integrate with Hexclave UI components automatically (for example verification, password reset, and magic-link flows).For custom flows, trigger
sendEmail from your server code:
Email server configuration
Configure your email server in the dashboard under Emails → Email Settings. There are four options:Shared (development only)
The default for new projects. Emails are sent fromnoreply@sent-with-hexclave.com using Hexclave’s shared infrastructure. Good for development - not suitable for production.
Custom SMTP
Connect any SMTP provider. Configure:- Host - e.g.
smtp.sendgrid.net - Port - typically 587 (STARTTLS) or 465 (implicit TLS)
- Username and Password
- Sender email and Sender name
Resend
Connect your Resend account by entering your API key. Hexclave configures the SMTP connection automatically.Managed
Let Hexclave manage your email domain. Hexclave handles DNS configuration and deliverability for you. Set up requires:- Choose a subdomain (e.g.
mail.yourapp.com) - Add the DNS records Hexclave provides
- Verify the domain in the dashboard
The dashboard tests your email configuration automatically when you save it by sending a test email.
Delivery stats
Hexclave tracks delivery metrics across multiple time windows (hour, day, week, month):- Sent - Successfully delivered
- Bounced - Rejected by the recipient’s mail server
- Marked as spam - Recipient flagged the email
Drafts
The dashboard includes a full draft editor where you can compose emails visually before sending. Drafts support:- TSX source editing with live preview
- Theme selection
- Recipient picker (specific users or all users)
- Scheduling
- Send history per draft