Mailer
📨 A mailer module for Nest framework (node.js)
Install / Use
/learn @nest-modules/MailerREADME
Features
- Built on Nodemailer — Supports SMTP, SES, sendmail, and more.
- Multiple Template Engines — Handlebars, Pug, EJS, Liquid, or MJML.
- NestJS Native — Dependency injection, async configuration, and module patterns.
- Multiple Transporters — Configure multiple SMTP servers and switch per message.
- CSS Inlining — Built-in css-inline ensures emails render correctly across all clients.
- Preview Emails — Preview emails in the browser during development.
Documentation
Full documentation is available at nest-modules.github.io/mailer.
Installation
pnpm add @nestjs-modules/mailer nodemailer
Install a template engine of your choice:
pnpm add handlebars
# or
pnpm add pug
# or
pnpm add ejs
Quick Start
// app.module.ts
import { Module } from '@nestjs/common';
import { MailerModule } from '@nestjs-modules/mailer';
import { HandlebarsAdapter } from '@nestjs-modules/mailer/adapters/handlebars.adapter';
@Module({
imports: [
MailerModule.forRoot({
transport: {
host: 'smtp.example.com',
port: 587,
auth: {
user: 'username',
pass: 'password',
},
},
defaults: {
from: '"No Reply" <noreply@example.com>',
},
template: {
adapter: new HandlebarsAdapter(),
},
}),
],
})
export class AppModule {}
// example.service.ts
import { Injectable } from '@nestjs/common';
import { MailerService } from '@nestjs-modules/mailer';
@Injectable()
export class ExampleService {
constructor(private readonly mailerService: MailerService) {}
async sendEmail() {
await this.mailerService.sendMail({
to: 'user@example.com',
subject: 'Hello',
template: 'welcome',
context: {
name: 'John',
},
});
}
}
Contributing
Contributions are welcome! See the documentation for details on the monorepo structure and development commands.
Contributors
- Cristiam Diaz
- Eduardo Leal
- Juan Echeverry
- Pat McGowan
- Paweł Partyka
- Wasutan Kitijerapat
- Alexandre Titeux
License
MIT
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
