Email sending, templates, and notifications.
Supports multiple email providers via HTTP APIs: Resend, Postmark, SendGrid, and Mailgun.
Emails are rendered using Liquid templates with support for custom confirmation and admin notification templates.
Build SVG ticket data from an email entry (non-PII only)
Build the data object exposed to Liquid templates
Generate SVG ticket attachments for all entries
Read email config from DB settings. Falls back to business email for fromAddress. Returns null if not configured.
Get host-level email config. Uses test override if set, otherwise reads env vars.
Type guard: checks if a string is a valid EmailProvider
Validates a basic email format: something@something.something
Normalizes email: trim and lowercase
Render all 3 parts (subject, html, text) using custom templates with fallback to defaults
Render a single Liquid template string with the given data
For testing: reset the engine (so filters can be re-registered after currency changes)
For testing: reset host email config to read from env vars.
Send a single email via the configured provider. Logs errors, never throws. Returns HTTP status or undefined on non-HTTP errors.
Send an error notification to the configured ntfy URL Returns a promise so callers can await delivery if needed. Delivery failures are logged locally (via logErrorLocal) but never throw.
Send registration confirmation + admin notification emails. Entries is an array because one registration can cover multiple events. Silently skips if email is not configured. Attaches one SVG ticket per entry to the confirmation email.
Send a test email to the business email address. Returns HTTP status or undefined on non-HTTP errors.
For testing: set host email config directly. Bypasses env vars to avoid races.
Updates the business email in the database. Pass empty string to clear the business email. Email is encrypted at rest.
Validate a Liquid template by parsing it (no rendering). Returns null if valid, or an error message string if invalid.
A base64-encoded email attachment
Attendee + event pair for email rendering
& { date: string; location: string; purchase_only: boolean; assign_built_site: boolean; }
Event data needed for registration pipeline (extends webhook event with display + assignment fields)
Union of all supported email provider keys, derived from the PROVIDERS map
Display labels for email providers — keys must match EmailProvider
Valid provider names, derived from the PROVIDERS map
Usage
import * as mod from "docs/email.ts";