@nestjs-modules/mailer 1.10.3 → 1.11.2

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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.11.2](https://github.com/nest-modules/mailer/compare/v1.11.0...v1.11.2) (2024-02-27)
6
+
7
+ ### [1.11.1](https://github.com/nest-modules/mailer/compare/v1.11.0...v1.11.1) (2024-02-27)
8
+
9
+ ## [1.11.0](https://github.com/nest-modules/mailer/compare/v1.10.3...v1.11.0) (2024-02-24)
10
+
5
11
  ### [1.10.3](https://github.com/nest-modules/mailer/compare/v1.10.2...v1.10.3) (2023-12-20)
6
12
 
7
13
 
package/README.md CHANGED
@@ -60,6 +60,8 @@ you can find all the documentation [here](https://nest-modules.github.io/mailer/
60
60
  * [Juan Echeverry](https://github.com/juandav)
61
61
  * [Pat McGowan](https://github.com/p-mcgowan)
62
62
  * [Paweł Partyka](https://github.com/partyka95)
63
+ * [Wasutan Kitijerapat](https://github.com/kitimark)
64
+ * [Alexandre Titeux](https://github.com/GFoniX)
63
65
 
64
66
  ### License
65
67
 
@@ -5,7 +5,7 @@ const ejs_1 = require("ejs");
5
5
  const lodash_1 = require("lodash");
6
6
  const fs = require("fs");
7
7
  const path = require("path");
8
- const css_inline_1 = require("css-inline");
8
+ const css_inline_1 = require("@css-inline/css-inline");
9
9
  class EjsAdapter {
10
10
  constructor(config) {
11
11
  this.precompiledTemplates = {};
@@ -42,7 +42,9 @@ class EjsAdapter {
42
42
  try {
43
43
  mail.data.html = (0, css_inline_1.inline)(html, this.config.inlineCssOptions);
44
44
  }
45
- catch (e) { }
45
+ catch (e) {
46
+ callback(e);
47
+ }
46
48
  }
47
49
  else {
48
50
  mail.data.html = html;
@@ -4,7 +4,7 @@ exports.HandlebarsAdapter = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
6
  const handlebars = require("handlebars");
7
- const css_inline_1 = require("css-inline");
7
+ const css_inline_1 = require("@css-inline/css-inline");
8
8
  const glob = require("glob");
9
9
  const lodash_1 = require("lodash");
10
10
  class HandlebarsAdapter {
@@ -70,7 +70,9 @@ class HandlebarsAdapter {
70
70
  try {
71
71
  mail.data.html = (0, css_inline_1.inline)(rendered, this.config.inlineCssOptions);
72
72
  }
73
- catch (e) { }
73
+ catch (e) {
74
+ callback(e);
75
+ }
74
76
  }
75
77
  else {
76
78
  mail.data.html = rendered;
@@ -4,7 +4,7 @@ exports.PugAdapter = void 0;
4
4
  const path = require("path");
5
5
  const lodash_1 = require("lodash");
6
6
  const pug_1 = require("pug");
7
- const css_inline_1 = require("css-inline");
7
+ const css_inline_1 = require("@css-inline/css-inline");
8
8
  class PugAdapter {
9
9
  constructor(config) {
10
10
  this.config = {
@@ -30,7 +30,9 @@ class PugAdapter {
30
30
  try {
31
31
  mail.data.html = (0, css_inline_1.inline)(body, this.config.inlineCssOptions);
32
32
  }
33
- catch (e) { }
33
+ catch (e) {
34
+ callback(e);
35
+ }
34
36
  }
35
37
  else {
36
38
  mail.data.html = body;
@@ -1,5 +1,5 @@
1
- import { InlineOptions } from 'css-inline';
1
+ import { Options } from '@css-inline/css-inline';
2
2
  export interface TemplateAdapterConfig {
3
- inlineCssOptions?: InlineOptions;
3
+ inlineCssOptions?: Options;
4
4
  inlineCssEnabled?: boolean;
5
5
  }
@@ -10,7 +10,9 @@ export declare class MailerService {
10
10
  private transporters;
11
11
  private templateAdapter;
12
12
  private initTemplateAdapter;
13
+ private readonly mailerLogger;
13
14
  constructor(mailerOptions: MailerOptions, transportFactory: IMailerTransportFactory);
15
+ private verifyTransporter;
14
16
  sendMail(sendMailOptions: ISendMailOptions): Promise<SentMessageInfo>;
15
17
  addTransporter(transporterName: string, config: string | smtpTransport | smtpTransport.Options): string;
16
18
  }
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var MailerService_1;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.MailerService = void 0;
4
5
  const tslib_1 = require("tslib");
@@ -7,7 +8,7 @@ const common_1 = require("@nestjs/common");
7
8
  const previewEmail = require("preview-email");
8
9
  const mailer_constant_1 = require("./constants/mailer.constant");
9
10
  const mailer_transport_factory_1 = require("./mailer-transport.factory");
10
- let MailerService = class MailerService {
11
+ let MailerService = MailerService_1 = class MailerService {
11
12
  initTemplateAdapter(templateAdapter, transporter) {
12
13
  if (templateAdapter) {
13
14
  transporter.use('compile', (mail, callback) => {
@@ -29,6 +30,7 @@ let MailerService = class MailerService {
29
30
  this.mailerOptions = mailerOptions;
30
31
  this.transportFactory = transportFactory;
31
32
  this.transporters = new Map();
33
+ this.mailerLogger = new common_1.Logger(MailerService_1.name);
32
34
  if (!transportFactory) {
33
35
  this.transportFactory = new mailer_transport_factory_1.MailerTransportFactory(mailerOptions);
34
36
  }
@@ -47,15 +49,24 @@ let MailerService = class MailerService {
47
49
  }
48
50
  if (mailerOptions.transports) {
49
51
  Object.keys(mailerOptions.transports).forEach((name) => {
50
- this.transporters.set(name, this.transportFactory.createTransport(this.mailerOptions.transports[name]));
51
- this.initTemplateAdapter(this.templateAdapter, this.transporters.get(name));
52
+ const transporter = this.transportFactory.createTransport(this.mailerOptions.transports[name]);
53
+ this.transporters.set(name, transporter);
54
+ this.verifyTransporter(transporter, name);
55
+ this.initTemplateAdapter(this.templateAdapter, transporter);
52
56
  });
53
57
  }
54
58
  if (mailerOptions.transport) {
55
59
  this.transporter = this.transportFactory.createTransport();
60
+ this.verifyTransporter(this.transporter);
56
61
  this.initTemplateAdapter(this.templateAdapter, this.transporter);
57
62
  }
58
63
  }
64
+ verifyTransporter(transporter, name) {
65
+ const transporterName = name ? ` '${name}'` : '';
66
+ transporter.verify()
67
+ .then(() => this.mailerLogger.error(`Transporter${transporterName} is ready`))
68
+ .catch((error) => this.mailerLogger.error(`Error occurred while verifying the transporter${transporterName}}: ${error.message}`));
69
+ }
59
70
  sendMail(sendMailOptions) {
60
71
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
72
  if (sendMailOptions.transporterName) {
@@ -86,7 +97,7 @@ let MailerService = class MailerService {
86
97
  }
87
98
  };
88
99
  exports.MailerService = MailerService;
89
- exports.MailerService = MailerService = tslib_1.__decorate([
100
+ exports.MailerService = MailerService = MailerService_1 = tslib_1.__decorate([
90
101
  (0, common_1.Injectable)(),
91
102
  tslib_1.__param(0, (0, common_1.Inject)(mailer_constant_1.MAILER_OPTIONS)),
92
103
  tslib_1.__param(1, (0, common_1.Optional)()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs-modules/mailer",
3
- "version": "1.10.3",
3
+ "version": "1.11.2",
4
4
  "private": false,
5
5
  "description": "NestJS - a mailer module (@mailer)",
6
6
  "keywords": [
@@ -52,9 +52,9 @@
52
52
  ]
53
53
  },
54
54
  "dependencies": {
55
- "css-inline": "0.11.2",
55
+ "@css-inline/css-inline": "0.13.0",
56
56
  "glob": "10.3.10",
57
- "mjml": "4.14.1",
57
+ "mjml": "4.15.3",
58
58
  "preview-email": "3.0.19"
59
59
  },
60
60
  "optionalDependencies": {
@@ -65,29 +65,29 @@
65
65
  "pug": "^3.0.2"
66
66
  },
67
67
  "devDependencies": {
68
- "@commitlint/cli": "18.4.3",
69
- "@commitlint/config-angular": "18.4.3",
70
- "@nestjs/common": "10.3.0",
71
- "@nestjs/core": "10.3.0",
72
- "@nestjs/testing": "10.3.0",
68
+ "@commitlint/cli": "18.6.1",
69
+ "@commitlint/config-angular": "18.6.1",
70
+ "@nestjs/common": "10.3.3",
71
+ "@nestjs/core": "10.3.3",
72
+ "@nestjs/testing": "10.3.3",
73
73
  "@types/glob": "8.1.0",
74
- "@types/jest": "29.5.11",
74
+ "@types/jest": "29.5.12",
75
75
  "@types/lodash": "4.14.202",
76
76
  "@types/nodemailer": "6.4.14",
77
77
  "@types/pug": "2.0.10",
78
- "@typescript-eslint/eslint-plugin": "6.15.0",
79
- "@typescript-eslint/parser": "6.15.0",
80
- "husky": "8.0.3",
78
+ "@typescript-eslint/eslint-plugin": "7.0.2",
79
+ "@typescript-eslint/parser": "7.0.2",
80
+ "husky": "9.0.11",
81
81
  "jest": "29.7.0",
82
- "lint-staged": "15.2.0",
83
- "nodemailer": "6.9.7",
84
- "nodemailer-mock": "2.0.3",
85
- "prettier": "3.1.1",
82
+ "lint-staged": "15.2.2",
83
+ "nodemailer": "6.9.10",
84
+ "nodemailer-mock": "2.0.4",
85
+ "prettier": "3.2.5",
86
86
  "reflect-metadata": "0.2.1",
87
87
  "rimraf": "5.0.5",
88
88
  "rxjs": "7.8.1",
89
89
  "standard-version": "9.5.0",
90
- "ts-jest": "29.1.1",
90
+ "ts-jest": "29.1.2",
91
91
  "ts-node": "10.9.2",
92
92
  "tslib": "2.6.2",
93
93
  "typescript": "5.3.3",