Skip to content

SMTPConfig type missing pool-related options (pool, maxConnections, maxMessages, rateDelta, rateLimit) #121

@jigs1996

Description

@jigs1996

Package version

10.2.0

Describe the bug

When configuring SMTP transport with connection pooling options in AdonisJS v7, TypeScript reports type errors:

Object literal may only specify known properties, and 'pool' does not exist in type 'SMTPConfig'.
Object literal may only specify known properties, but 'maxConnections' does not exist in type 'SMTPConfig'. Did you mean to write 'connection'?
Object literal may only specify known properties, and 'maxMessages' does not exist in type 'SMTPConfig'.

Example config that triggers the errors:

smtp: transports.smtp({
  host: env.get('SMTP_HOST'),
  port: env.get('SMTP_PORT'),
  pool: true,
  maxConnections: 5,
  maxMessages: 100,
}),

These options work correctly at runtime because nodemailer detects pool: true and internally uses SMTPPool transport. The issue is purely a type definition gap — SMTPConfig in src/types.ts includes SMTPConnection.Options but not the pool-specific properties from nodemailer's SMTPPool.Options.

Reproduction repo

N/A — can be reproduced by adding pool: true to any SMTP config in an AdonisJS v7 app.

Current workaround

Using @ts-ignore to suppress the type errors.

Fix

I've already implemented a fix that uses Partial<Pick<SMTPPool.Options, 'pool' | 'maxConnections' | 'maxMessages' | 'rateDelta' | 'rateLimit'>> to add the missing pool properties to SMTPConfig. All existing tests pass. Happy to open a PR if this approach looks good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions