@nestjs-modules/mailer 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +115 -0
- package/dist/interfaces/mailer-options.interface.d.ts +1 -1
- package/dist/mailer.service.d.ts +2 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`292a0f4`](https://github.com/nest-modules/mailer/commit/292a0f41aa147e7cb508d48a012b6645f8be26f5) Thanks [@juandav](https://github.com/juandav)! - Allow all transport types for additional transports and addTransporter method.
|
|
8
|
+
|
|
9
|
+
## 2.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`27137db`](https://github.com/nest-modules/mailer/commit/27137dbc165038d2c8b97b610eb646f2f2c5bffc) Thanks [@juandav](https://github.com/juandav)! - Include README.md in published npm package.
|
|
14
|
+
|
|
3
15
|
## 2.1.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="http://nestjs.com/" target="blank">
|
|
3
|
+
<img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
A mailer module for <a href="http://nestjs.com/">NestJS</a> using <a href="https://nodemailer.com/">Nodemailer</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@nestjs-modules/mailer"><img src="https://img.shields.io/npm/v/@nestjs-modules/mailer.svg" alt="NPM Version" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@nestjs-modules/mailer"><img src="https://img.shields.io/npm/l/@nestjs-modules/mailer.svg" alt="Package License" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@nestjs-modules/mailer"><img src="https://img.shields.io/npm/dm/@nestjs-modules/mailer.svg" alt="NPM Downloads" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Built on Nodemailer** — Supports SMTP, SES, sendmail, and more.
|
|
20
|
+
- **Multiple Template Engines** — Handlebars, Pug, EJS, Liquid, or MJML.
|
|
21
|
+
- **NestJS Native** — Dependency injection, async configuration, and module patterns.
|
|
22
|
+
- **Multiple Transporters** — Configure multiple SMTP servers and switch per message.
|
|
23
|
+
- **CSS Inlining** — Built-in css-inline ensures emails render correctly across all clients.
|
|
24
|
+
- **Preview Emails** — Preview emails in the browser during development.
|
|
25
|
+
|
|
26
|
+
## Documentation
|
|
27
|
+
|
|
28
|
+
Full documentation is available at **[nest-modules.github.io/mailer](https://nest-modules.github.io/mailer/)**.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add @nestjs-modules/mailer nodemailer
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Install a template engine of your choice:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm add handlebars
|
|
40
|
+
# or
|
|
41
|
+
pnpm add pug
|
|
42
|
+
# or
|
|
43
|
+
pnpm add ejs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// app.module.ts
|
|
50
|
+
import { Module } from '@nestjs/common';
|
|
51
|
+
import { MailerModule } from '@nestjs-modules/mailer';
|
|
52
|
+
import { HandlebarsAdapter } from '@nestjs-modules/mailer/adapters/handlebars.adapter';
|
|
53
|
+
|
|
54
|
+
@Module({
|
|
55
|
+
imports: [
|
|
56
|
+
MailerModule.forRoot({
|
|
57
|
+
transport: {
|
|
58
|
+
host: 'smtp.example.com',
|
|
59
|
+
port: 587,
|
|
60
|
+
auth: {
|
|
61
|
+
user: 'username',
|
|
62
|
+
pass: 'password',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
defaults: {
|
|
66
|
+
from: '"No Reply" <noreply@example.com>',
|
|
67
|
+
},
|
|
68
|
+
template: {
|
|
69
|
+
adapter: new HandlebarsAdapter(),
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
})
|
|
74
|
+
export class AppModule {}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// example.service.ts
|
|
79
|
+
import { Injectable } from '@nestjs/common';
|
|
80
|
+
import { MailerService } from '@nestjs-modules/mailer';
|
|
81
|
+
|
|
82
|
+
@Injectable()
|
|
83
|
+
export class ExampleService {
|
|
84
|
+
constructor(private readonly mailerService: MailerService) {}
|
|
85
|
+
|
|
86
|
+
async sendEmail() {
|
|
87
|
+
await this.mailerService.sendMail({
|
|
88
|
+
to: 'user@example.com',
|
|
89
|
+
subject: 'Hello',
|
|
90
|
+
template: 'welcome',
|
|
91
|
+
context: {
|
|
92
|
+
name: 'John',
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Contributing
|
|
100
|
+
|
|
101
|
+
Contributions are welcome! See the [documentation](https://nest-modules.github.io/mailer/) for details on the monorepo structure and development commands.
|
|
102
|
+
|
|
103
|
+
### Contributors
|
|
104
|
+
|
|
105
|
+
- [Cristiam Diaz](https://github.com/cdiaz)
|
|
106
|
+
- [Eduardo Leal](https://github.com/eduardoleal)
|
|
107
|
+
- [Juan Echeverry](https://github.com/juandav)
|
|
108
|
+
- [Pat McGowan](https://github.com/p-mcgowan)
|
|
109
|
+
- [Paweł Partyka](https://github.com/partyka95)
|
|
110
|
+
- [Wasutan Kitijerapat](https://github.com/kitimark)
|
|
111
|
+
- [Alexandre Titeux](https://github.com/GFoniX)
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT
|
package/dist/mailer.service.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SentMessageInfo } from 'nodemailer';
|
|
2
|
-
import
|
|
3
|
-
import { MailerOptions } from './interfaces/mailer-options.interface';
|
|
2
|
+
import { MailerOptions, TransportType } from './interfaces/mailer-options.interface';
|
|
4
3
|
import { MailerTransportFactory as IMailerTransportFactory } from './interfaces/mailer-transport-factory.interface';
|
|
5
4
|
import { ISendMailOptions } from './interfaces/send-mail-options.interface';
|
|
6
5
|
export declare class MailerService {
|
|
@@ -18,5 +17,5 @@ export declare class MailerService {
|
|
|
18
17
|
private verifyTransporter;
|
|
19
18
|
verifyAllTransporters(): Promise<boolean>;
|
|
20
19
|
sendMail(sendMailOptions: ISendMailOptions): Promise<SentMessageInfo>;
|
|
21
|
-
addTransporter(transporterName: string, config:
|
|
20
|
+
addTransporter(transporterName: string, config: TransportType): string;
|
|
22
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs-modules/mailer",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NestJS - a mailer module (@mailer)",
|
|
6
6
|
"keywords": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"Joao vitor FREZYN <00001097715413SP@al.educacao.sp.gov.br>"
|
|
49
49
|
],
|
|
50
50
|
"scripts": {
|
|
51
|
-
"prebuild": "rimraf dist",
|
|
51
|
+
"prebuild": "rimraf dist && cp ../../README.md .",
|
|
52
52
|
"build": "tsc -p tsconfig.json",
|
|
53
53
|
"check": "biome check .",
|
|
54
54
|
"test": "jest"
|