Skip to content

basalt / mailer/src / MailerPluginOptions

Interface: MailerPluginOptions ​

Defined in: mailer/src/index.ts:158

Extends ​

Properties ​

driver? ​

> optional driver?: "log" | "memory" | MailDriver | "resend" | "ses" | "mailgun"

Defined in: mailer/src/index.ts:170

A built-in driver by name, or any MailDriver instance.

SMTP used to be reachable here as 'smtp', which is why this package depended on nodemailer and shipped it to every app — including those on Resend, SES or Mailgun, which are plain HTTP APIs needing no SMTP client. Use smtpMailer({ host }) from @basaltkit/mailer-smtp instead.

The instance form is also how a driver of your own plugs in; before this there was no way to supply one.


from? ​

> optional from?: string | (() => string | undefined)

Defined in: mailer/src/index.ts:53

Default sender. A function is resolved on every send — use it for tenant-aware branding (e.g. read ctx().tenant): () => currentTenantFrom().

Inherited from ​

MailerOptions.from


layout? ​

> optional layout?: (html, context) => string

Defined in: mailer/src/index.ts:62

Wraps every rendered HTML body in a shared layout (branding, header/footer). Called with the mail's own HTML and its context; return the full document. Read ctx().tenant inside for per-tenant branding. Only applied when the mail has an HTML body. Any template engine (MJML, React Email, Handlebars…) can be used here — or inside a mail's own html().

Parameters ​

html ​

string

context ​
data ​

unknown

mail ​

string

Returns ​

string

Inherited from ​

MailerOptions.layout


logBody? ​

> optional logBody?: boolean

Defined in: mailer/src/index.ts:185

'log' driver only: include the full message body in the log line. Default: true only with NODE_ENV=development/test, false anywhere else incl. an unset NODE_ENV (bodies carry reset links and tokens that must not be retained by log aggregators).


mailgun? ​

> optional mailgun?: MailgunDriverOptions

Defined in: mailer/src/index.ts:176

Required with the 'mailgun' driver.


previews? ​

> optional previews?: MailPreview<unknown>[]

Defined in: mailer/src/index.ts:191

Mails to expose through the mail:preview CLI command (a browser dev server). Each carries sample data; the preview reuses the mailer's own schema validation and layout.


replyTo? ​

> optional replyTo?: string

Defined in: mailer/src/index.ts:54

Inherited from ​

MailerOptions.replyTo


resend? ​

> optional resend?: ResendDriverOptions

Defined in: mailer/src/index.ts:172

Required with the 'resend' driver.


ses? ​

> optional ses?: SesDriverOptions

Defined in: mailer/src/index.ts:174

Required with the 'ses' driver.


sink? ​

> optional sink?: (line) => void

Defined in: mailer/src/index.ts:178

Sink for the 'log' driver. Default: console.log

Parameters ​

line ​

string

Returns ​

void

Released under the MIT License.