Skip to content

email-plugin SMTPTransportOptions do not include Nodemailer pooled SMTP options #4602

@TheHypnoo

Description

@TheHypnoo

Describe the bug
@vendure/email-plugin with transport.type = 'smtp' does not expose Nodemailer pooled SMTP options in its TypeScript types, even though those options do work at runtime because Vendure forwards the transport object directly to nodemailer.createTransport().

This causes a mismatch between runtime behavior and typings. In practice, options like pool and maxConnections are useful when configuring pooled SMTP transports, but TypeScript rejects them when configuring EmailPlugin.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Vendure project using @vendure/email-plugin with SMTP transport.
  2. Configure the plugin like this:
EmailPlugin.init({
  route: 'mailbox',
  transport: {
    type: 'smtp',
    host: process.env.EMAIL_HOST,
    port: Number(process.env.EMAIL_PORT),
    pool: true,
    maxConnections: 1,
    auth: {
      user: process.env.EMAIL_USER,
      pass: process.env.EMAIL_PASSWORD,
    },
  },
  handlers: [],
})
  1. Run TypeScript compilation with tsc --noEmit.
  2. See the type error complaining that pool is not a valid property of SMTPTransportOptions.

Expected behavior
I expected EmailPlugin SMTP typings to accept the same pooled SMTP options that are supported by Nodemailer at runtime, or for the docs to explicitly state that these options are not supported.

Actual behavior
TypeScript rejects valid Nodemailer pooled SMTP options such as pool and maxConnections, even though Vendure passes the transport object directly to Nodemailer at runtime.

Screenshots/Videos
Not applicable.

Error logs
Relevant TypeScript error:

error TS2345: Argument of type '{ ... pool: true; maxConnections: number; }'
is not assignable to parameter of type 'EmailPluginOptions | EmailPluginDevModeOptions'.

Types of property 'transport' are incompatible.
Object literal may only specify known properties, and 'pool' does not exist in type 'SMTPTransportOptions | ...'

Environment (please complete the following information):

  • @vendure/core version: ^3.5.6
  • @vendure/email-plugin version: ^3.5.6
  • Nodejs version: v22.15.0
  • Database (mysql/postgres etc): PostgreSQL
  • Operating System (Windows/macOS/Linux): macOS
  • Browser (if applicable): N/A
  • Package manager (npm/yarn/pnpm): yarn@1.22.22

Configuration
If relevant, share your Vendure configuration (remove sensitive data):

EmailPlugin.init({
  route: 'mailbox',
  transport: {
    type: 'smtp',
    host: process.env.EMAIL_HOST,
    port: Number(process.env.EMAIL_PORT),
    auth: {
      user: process.env.EMAIL_USER,
      pass: process.env.EMAIL_PASSWORD,
    },
  },
  handlers: [
  ],
})

The issue appears when trying to extend this SMTP transport config with Nodemailer pooled SMTP options like:

pool: true,
maxConnections: 1,

Minimal reproduction
A minimal reproduction is:

  1. Install Vendure with @vendure/email-plugin.
  2. Configure EmailPlugin.init({ transport: { type: 'smtp', ... } }).
  3. Add pool or maxConnections, to the SMTP transport object.
  4. Run tsc --noEmit.

Workaround
A temporary workaround is to use a type assertion, for example:

transport: emailTransport as SMTPTransportOptions

Additional context

I verified locally that:

  • TypeScript rejects these properties on SMTPTransportOptions
  • NodemailerEmailSender still forwards them to nodemailer.createTransport() at runtime

The main concern is not whether Nodemailer supports these options, but that Vendure's typings do not reflect the runtime behavior of the SMTP transport configuration.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions