Skip to content

Older version

You're reading the docs for v2 (2.3.x). The latest version is v4.

Read the v4 guide · Migrate from v2 to v3 · Migrate from v3 to v4 · Versions & upgrading

v2 documentation ​

These are the docs for @nestjs-modules/mailer 2.3.x, archived as they were for the last v2 release (2.3.10). v2 is end of life: it gets no more fixes, including security fixes. Plan an upgrade to v4, through v3 (see Versions & upgrading).

Install ​

Pin the major version so a fresh install doesn't pull v4:

bash
pnpm add @nestjs-modules/mailer@^2 nodemailer
bash
npm install @nestjs-modules/mailer@^2 nodemailer
bash
yarn add @nestjs-modules/mailer@^2 nodemailer

In v2 every template engine (ejs, handlebars, liquidjs, mjml, nunjucks, pug, preview-email and their types) is installed automatically as an optional dependency.

Requirements ​

v2 (2.3.10)
NestJS7 – 11 (NestJS 12 support was added in 3.0.0)
Node.jsNo engines constraint; 2.3.x was tested on Node.js 20, 22 and 24
nodemailer>= 8.0.5
Template enginesInstalled automatically; peer floors handlebars >= 4.7.9, pug >= 3.0.1, ejs >= 3.1.2, liquidjs >= 10.25.5, nunjucks >= 3.2.0, mjml >= 4.15.3
Optional integrations@nestjs/event-emitter >= 2, @nestjs/terminus >= 10, bullmq >= 4

Known issues fixed in v3

The ejs and pug floors of v2 allow versions with known template-injection CVEs, and v2 does not escape {{key}} placeholders in inline html, fetches remote stylesheets when inlining CSS and does not validate i18n locales. These were fixed in 3.0.0.

Pages ​

Upgrading ​

  1. Migrate from v2 to v3: template engines, inline {{key}} escaping, remote stylesheets, Pug options, health check output.
  2. Migrate from v3 to v4: retries on by default, typed errors, validation, plain-text part.

Released under the MIT License.