Skip to content

Conversation

@ctlchan
Copy link
Contributor

@ctlchan ctlchan commented Jan 29, 2026

This pull request introduces an EmailTemplateManager class and a standard for defining future email templates.

Methods

  • create(): an asynchronous factory method that registers partials before returning a new instance.
  • renderTemplate(): renders a template by a given name followed by the defined standard/convention (see below), returning strings containing a subject line as well as the HTML and plaintext versions of the template.
  • previewTemplate(): returns a string for the email preview text.
  • getTemplateList(): returns a list of the valid template names that can be passed to renderTemplate() and previewTemplate()

Additional Notes

  • both renderTemplate() and previewTemplate()are made generic over EmailTemplateDataMap so that a superset of required parameters to the template are enforced.
  • the templates implemented so far are skeleton templates with no styling. Feel free to improve this.
  • the EmailService class was modified with a factory method to accommodate the integration of EmailTemplateManager. Changes were made accordingly to authRoutes.ts

Template Definition Convention

  • directory names under backend/src/email/templates are used as the template name in Handlebars
  • .hbs files with just the template name represent the HTML version of the email
  • _subject.hbs, _plain.hbs, and _preview.hbs suffixes after the template name correspond to the subject, plaintext, and email preview respectively (ex. welcome_plain.hbs)

Templates introduced

  • welcome
  • meetingConfirmation
  • update
  • passwordReset

Copy link
Member

@Flapjacck Flapjacck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Flapjacck Flapjacck force-pushed the issue-113-email-template-system branch from 094d3f1 to 4281a6b Compare February 3, 2026 19:42
@Flapjacck Flapjacck merged commit dcb7719 into main Feb 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants