# @fastnloud/nest-mail

> Mail module for Nest that uses Nodemailer to deliver messages.

Latest version **2.0.0** (published 2026-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fastnloud/nest-mail
pnpm add @fastnloud/nest-mail
yarn add @fastnloud/nest-mail
bun add @fastnloud/nest-mail
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-11-03 |
| First published | 2023-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | jaap |
| Maintainers | fastnloud |
| Keywords | nest, mail, smtp transporter, nodemailer |

## Links

- npm: https://www.npmjs.com/package/@fastnloud/nest-mail
- Repository: https://github.com/fastnloud/nest-mail
- Homepage: https://github.com/fastnloud/nest-mail#readme
- Issues: https://github.com/fastnloud/nest-mail/issues
- npm.io page: https://npm.io/package/@fastnloud/nest-mail

## Dependencies (2)

- [joi](https://npm.io/package/joi.md) ^18.0.0
- [nodemailer](https://npm.io/package/nodemailer.md) ^10.3.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-11-03
- 2.0.0-rc.1 — 2026-07-14
- 2.0.0-rc.0 — 2025-05-26
- 1.1.0 — 2025-04-07
- 1.0.4 — 2024-05-02
- 1.0.3 — 2023-06-30
- 1.0.2 — 2023-06-06
- 1.0.1 — 2023-06-06
- 1.0.0 — 2023-05-01
- 0.0.12 — 2023-04-19
- 0.0.11 — 2023-03-29
- 0.0.10 — 2023-03-29
- 0.0.9 — 2023-03-29
- 0.0.8 — 2023-03-29
- 0.0.7 — 2023-03-28
- … 6 more at https://npm.io/package/@fastnloud/nest-mail/versions

## README

## Description

Mail module for Nest that uses Nodemailer to deliver messages.

## Installation

```bash
$ npm i --save @fastnloud/nest-mail
```

## Setup

Import module:

```ts
import { MailModule } from '@fastnloud/nest-mail';
import { Module } from '@nestjs/common';

@Module({
  imports: [MailModule],
})
export class AppModule {}
```

A sample `.env` file looks something like this:

```
MAIL_DEFAULT_FROM_ADDRESS=john.doe@example.com
MAIL_DEFAULT_FROM_NAME=John Doe
MAIL_RECIPIENTS=
MAIL_URL=smtp://localhost:1025
```

## Usage

```ts
import { SmtpTransporter } from '@fastnloud/nest-mail';
import { Injectable } from '@nestjs/common';
import { SentMessageInfo } from 'nodemailer';

@Injectable()
export class MailService {
  constructor(private readonly smtpTransporter: SmtpTransporter) {}

  async send(): Promise<void> {
    this.smtpTransporter.send(
      {
        to: 'jane.doe@example.com',
        subject: `hello`,
        text: 'world',
      },
      (error: Error | null, info: SentMessageInfo) => {
        if (error) {
          throw error;
        }

        console.log(info);
      },
    );
  }
}
```

## License

nest-mail is [MIT licensed](LICENSE).

---
_Source: https://npm.io/package/@fastnloud/nest-mail · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
