# @tomei/mailer

> Tomei Mailer Package

Latest version **0.10.2** (published 2026-03-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install @tomei/mailer
pnpm add @tomei/mailer
yarn add @tomei/mailer
bun add @tomei/mailer
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.10.2 |
| Published | 2026-03-17 |
| First published | 2023-06-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 290.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tomei |
| Maintainers | it-assets |

## Links

- npm: https://www.npmjs.com/package/@tomei/mailer
- npm.io page: https://npm.io/package/@tomei/mailer

## Recent versions

- 0.10.2 (latest) — 2026-03-17
- 1.1.0-test.2 (test) — 2026-06-05
- 1.0.1 (dev) — 2026-03-17
- 1.1.0-test.1 — 2026-06-05
- 0.8.1-test.1 — 2026-06-04
- 0.10.7 — 2026-03-17
- 0.10.0-dev.1 — 2026-03-13
- 0.10.0 — 2026-03-13
- 0.7.1-dev.2 — 2026-01-08
- 0.7.1-dev.1 — 2026-01-08
- 0.7.1 — 2025-12-26
- 0.6.2 — 2025-09-18
- 0.6.0 — 2025-09-11
- 0.5.21 — 2024-11-28
- 0.5.20 — 2024-11-27
- … 37 more at https://npm.io/package/@tomei/mailer/versions

## README

# Tomei Mailer

## Version Note

> Current tomei mailer package version only supports **nodemailer** and **nestjs/mailer**

## Getting Started

- Execute `npm install @tomei/mailer` on your project

- Ensure you have setup the environment from `.sampledotenv` in your project `.env` file

## Package Implementation

- **Nodemailer**

```javascript
const nodemailer = require('nodemailer');
const { Mailer } = require('@tomei/mailer');

const mailConfig = {
  host: process.env.SMTP_HOST,
  port: Number(process.env.SMTP_PORT),
  secure: Number(process.env.SMTP_PORT) === 465,
  auth: {
    user: process.env.EMAIL_SENDER,
    pass: process.env.EMAIL_PASSWORD,
  },
};

//Tomei Mailer Package Instatiation
const transporter = new Mailer(nodemailer, mailConfig);

async function sendMailFunc() {
  await transporter.sendMail({
    from: 'sender@mail.com',
    to: 'recipient@mail.com',
    subject: 'Test Email Subject',
    text: 'Test Email Content',
  });
}
```

- **NestJS/Mailer**

```ts
import { MailerService } from '@nestjs-modules/mailer'
import { ConfigService } from '@nestjs/config'
import { Mailer, MailerInterfaces } from  '@tomei/mailer';

export class MailService {
	private mailer: Mailer

	constructor(
		private mailerService: MailerService,
		private configService: ConfigService
	) {
		const mailConfig: MailerInterfaces.MailConfig = {
			host: this.configService.get('SMTP_HOST'),
			port: Number(this.configService.get('SMTP_PORT')),
			secure: Number(this.configService.get('SMTP_PORT')) === 465,
			auth: {
				user: this.configService.get('EMAIL_SENDER'),
				pass: this.configService.get('EMAIL_PASSWORD'),
			},
		}

		//Tomei Mailer Package Instatiation
		this.mailer = new Mailer(mailerService, mailConfig)
	}

	async sendMailMethod() {
		await this.mailer.sendMail({
			to: 'recipient@mail.com',
			subject: 'Test Subject',
			template: <email_template_dir_path>,
			context: {
				System: 'My Project System'
			}
		})
	}
}
```

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