method MailService.prototype.sendTemplate
MailService.prototype.sendTemplate(
template: string,
message: Omit<MailMessage, "html" | "text">,
data: Readonly<Record<string, unknown>>
): Promise<void>

Renders a named template and sends the result. The subject is taken verbatim from message; the template supplies the html/text bodies.

Parameters

template: string

Template name

message: Omit<MailMessage, "html" | "text">

Envelope (recipients, subject, optional from/cc/bcc)

data: Readonly<Record<string, unknown>>

Template variables

Return Type

Promise<void>

Throws

Error

If the template is unknown, a variable is missing, no from can be resolved, or the provider rejects the message

Usage

import { MailService } from "mail-plugin/src/index.ts";