Skip to main content

Email Templates

Kyqu supports customizable email templates per project with a fallback chain: project-specific → superadmin defaults → built-in defaults.

Template Resolution Order

1. Project-specific custom template
(saved in project_email_templates with project_id)
2. Superadmin platform-wide default
(saved in project_email_templates with project_id = '__default__')
3. Built-in hardcoded template
(defined in platform-service.js)

Template Purposes

PurposeDescription
email_verificationVerify email address
password_resetReset forgotten password
magic_linkPasswordless sign-in link
force_password_resetAdmin-forced password reset

Template Variables

VariableDescription
{{project_name}}Project display name
{{action_url}}Action link URL (auto-generated)
{{expires_in}}Token expiration time (e.g., "15 minutes")
{{preheader}}Email preheader text

Built-in Templates

Default subject lines:

PurposeSubject
email_verificationVerify your {{project_name}} account
password_resetReset your {{project_name}} password
magic_linkSign in to {{project_name}}
force_password_resetYour {{project_name}} password needs to be reset

Customizing Templates

Via the Admin Dashboard

  1. Navigate to the project's Email Templates section
  2. Select a purpose to edit
  3. Set the subject line, HTML body, and text body
  4. Save — the template is immediately active

Via the API

# Save custom template
curl -X PUT /api/admin/projects/{id}/email-templates/email_verification \
-H "Content-Type: application/json" \
-d '{
"subject": "Welcome to {{project_name}}",
"htmlBody": "<h1>Verify your email</h1><a href=\"{{action_url}}\">Click here</a>",
"textBody": "Verify your email: {{action_url}}"
}'

# Reset to default
curl -X DELETE /api/admin/projects/{id}/email-templates/email_verification

# List all templates
curl GET /api/admin/projects/{id}/email-templates

HTML Email Guidelines

Emails are rendered with inline styles (table-based layout, no CSS flex/grid) for maximum email client compatibility:

  • Gmail: Supports basic table layouts and inline styles
  • Outlook: Requires table-based layout (Word rendering engine)
  • Apple Mail: Supports modern CSS
  • Yahoo: Similar to Gmail

The built-in template uses:

  • Table-based layout
  • Inline CSS on every element
  • Dark green header with project name and Kyqu badge
  • White card body with centered content
  • CTA button with inline border-radius
  • Dark green footer with Kyqu URL
  • Support for dark mode via <meta name="color-scheme">

Superadmin Default Templates

Superadmins can set platform-wide default templates that apply to all projects unless overridden:

# List platform defaults
curl GET /api/admin/superadmin/default-templates

# Save platform default
curl -X PUT /api/admin/superadmin/default-templates/email_verification \
-H "Content-Type: application/json" \
-d '{
"subject": "Welcome!",
"htmlBody": "...",
"textBody": "..."
}'

# Reset platform default
curl -X DELETE /api/admin/superadmin/default-templates/email_verification