Skip to main content

EmailGenerator

An EmailGenerator generates the subject and body details of an email.

Signature

onInit

method(options: EmailPluginOptions) => void | Promise<void>

Any necessary setup can be performed here.

generate

method(from: string, subject: string, body: string, templateVars: { [key: string]: any }) => Pick<EmailDetails, 'from' | 'subject' | 'body'>

Given a subject and body from an email template, this method generates the final interpolated email text.

Uses Handlebars (https://handlebarsjs.com/) to output MJML (https://mjml.io) which is then compiled down to responsive email HTML.

Signature

onInit

method(options: InitializedEmailPluginOptions) =>

generate

method(from: string, subject: string, template: string, templateVars: any) =>
Was this chapter helpful?
Report Issue
Edited Feb 10, 2026ยทEdit this page