Docs/API Reference/Mail

Mail API: message and transport

Required: to, subject. Optional: text, html, from, cc, bcc, replyTo, attachments, priority, headers.

1 min read

MailMessage#

Required: to, subject. Optional: text, html, from, cc, bcc, replyTo, attachments, priority, headers.

MailRecipient is either a string or MailAddress ({ name?, address }). MailAttachment can contain content or path, plus filename/content type/content ID/encoding metadata.

IMailer#

A transport implements:

ts
interface IMailer {
  sendMail(message: MailMessage): Promise<void>;
}

Register a custom transport under CUSTOM_MAILER and select it with MAIL_TRANSPORT=custom. The transport owns delivery mechanics; domain-specific message content belongs in the calling application or package facade.

Built-in helpers#

The root entry point exports sendMail, sendVerifyEmail, sendResetPassword, sendRecoveryCode and send2FACode. Treat codes as secrets: never log them or include them in analytics.

veap
Preparing0%