@mavogel/awscdk-rootmail 0.1.51 → 0.1.53

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.
Files changed (63) hide show
  1. package/.jsii +10 -10
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
  5. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +1 -1
  6. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
  7. package/node_modules/@aws-sdk/client-route-53/package.json +1 -1
  8. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
  9. package/node_modules/@aws-sdk/client-s3/package.json +2 -2
  10. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
  11. package/node_modules/@aws-sdk/client-ses/package.json +1 -1
  12. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
  13. package/node_modules/@aws-sdk/client-ssm/package.json +1 -1
  14. package/node_modules/@zone-eu/mailsplit/package.json +10 -5
  15. package/node_modules/libmime/CHANGELOG.md +7 -0
  16. package/node_modules/libmime/package.json +10 -6
  17. package/node_modules/libqp/CHANGELOG.md +7 -0
  18. package/node_modules/libqp/README.md +1 -1
  19. package/node_modules/libqp/dist/cjs/libqp.d.ts +8 -2
  20. package/node_modules/libqp/dist/cjs/libqp.js +159 -12
  21. package/node_modules/libqp/dist/esm/libqp.d.ts +8 -2
  22. package/node_modules/libqp/dist/esm/libqp.js +159 -12
  23. package/node_modules/libqp/lib/libqp.js +1 -1
  24. package/node_modules/libqp/package.json +14 -8
  25. package/node_modules/linkify-it/README.md +49 -86
  26. package/node_modules/linkify-it/build/index.cjs.js +636 -825
  27. package/node_modules/linkify-it/build/index.cjs.js.map +1 -0
  28. package/node_modules/linkify-it/build/index.d.ts +236 -0
  29. package/node_modules/linkify-it/build/index.mjs +538 -0
  30. package/node_modules/linkify-it/build/index.mjs.map +1 -0
  31. package/node_modules/linkify-it/package.json +23 -20
  32. package/node_modules/mailparser/CHANGELOG.md +14 -0
  33. package/node_modules/mailparser/dist/cjs/mail-parser.js +34 -14
  34. package/node_modules/mailparser/dist/esm/mail-parser.js +34 -14
  35. package/node_modules/mailparser/package.json +11 -7
  36. package/node_modules/nodemailer/CHANGELOG.md +13 -0
  37. package/node_modules/nodemailer/README.md +4 -0
  38. package/node_modules/nodemailer/dist/cjs/fetch/cookies.js +4 -1
  39. package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
  40. package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
  41. package/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +3 -0
  42. package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +11 -3
  43. package/node_modules/nodemailer/dist/esm/fetch/cookies.js +4 -1
  44. package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
  45. package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
  46. package/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +3 -0
  47. package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +11 -3
  48. package/node_modules/nodemailer/package.json +11 -6
  49. package/node_modules/uc.micro/README.md +18 -1
  50. package/node_modules/uc.micro/build/index.cjs.js +13 -18
  51. package/node_modules/uc.micro/build/index.d.ts +6 -0
  52. package/node_modules/uc.micro/build/index.mjs +8 -0
  53. package/node_modules/uc.micro/package.json +12 -17
  54. package/package.json +11 -11
  55. package/node_modules/linkify-it/index.mjs +0 -646
  56. package/node_modules/linkify-it/lib/re.mjs +0 -193
  57. package/node_modules/uc.micro/categories/Cc/regex.mjs +0 -1
  58. package/node_modules/uc.micro/categories/Cf/regex.mjs +0 -1
  59. package/node_modules/uc.micro/categories/P/regex.mjs +0 -1
  60. package/node_modules/uc.micro/categories/S/regex.mjs +0 -1
  61. package/node_modules/uc.micro/categories/Z/regex.mjs +0 -1
  62. package/node_modules/uc.micro/index.mjs +0 -8
  63. package/node_modules/uc.micro/properties/Any/regex.mjs +0 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkify-it",
3
- "version": "5.0.2",
3
+ "version": "6.1.0",
4
4
  "description": "Links recognition library with FULL unicode support",
5
5
  "keywords": [
6
6
  "linkify",
@@ -8,22 +8,22 @@
8
8
  "autolink",
9
9
  "autolinker"
10
10
  ],
11
- "repository": "markdown-it/linkify-it",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/markdown-it/linkify-it.git"
14
+ },
12
15
  "main": "build/index.cjs.js",
13
- "module": "index.mjs",
16
+ "module": "build/index.mjs",
17
+ "types": "build/index.d.ts",
14
18
  "exports": {
15
19
  ".": {
20
+ "types": "./build/index.d.ts",
16
21
  "require": "./build/index.cjs.js",
17
- "import": "./index.mjs"
22
+ "import": "./build/index.mjs"
18
23
  },
19
- "./*": {
20
- "require": "./*",
21
- "import": "./*"
22
- }
24
+ "./package.json": "./package.json"
23
25
  },
24
26
  "files": [
25
- "index.mjs",
26
- "lib/",
27
27
  "build/"
28
28
  ],
29
29
  "license": "MIT",
@@ -39,25 +39,28 @@
39
39
  ],
40
40
  "scripts": {
41
41
  "lint": "eslint .",
42
- "test": "npm run lint && npm run build && c8 --exclude build --exclude test -r text -r html -r lcov node --test",
43
- "demo": "npm run lint && node support/build_demo.mjs",
44
- "doc": "node support/build_doc.mjs",
45
- "build": "rollup -c support/rollup.config.mjs",
46
- "gh-pages": "npm run demo && npm run doc && gh-pages -d demo -f",
47
- "prepack": "npm test && npm run build && npm run demo && npm run doc",
42
+ "type-check": "tsc --noEmit",
43
+ "test": "npm run lint && npm run build && npm run type-check && c8 --exclude build --exclude test -r text -r html -r lcov node --test",
44
+ "doc": "typedoc",
45
+ "build": "node support/build_dist.mjs && node support/build_demo.mjs",
46
+ "gh-pages": "npm run build && npm run doc && gh-pages -d demo -f",
47
+ "prepack": "npm test && npm run doc",
48
48
  "postpublish": "npm run gh-pages"
49
49
  },
50
50
  "dependencies": {
51
- "uc.micro": "^2.0.0"
51
+ "uc.micro": "^3.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@rollup/plugin-node-resolve": "^15.2.3",
55
54
  "c8": "^11.0.0",
56
55
  "eslint": "^9.39.3",
57
56
  "gh-pages": "^6.1.0",
58
57
  "mitata": "^1.0.34",
59
58
  "neostandard": "^0.13.0",
60
- "ndoc": "^6.0.0",
61
- "rollup": "^4.6.1"
59
+ "rollup": "^4.62.2",
60
+ "rollup-plugin-dts": "^6.4.1",
61
+ "typedoc": "^0.28.19",
62
+ "typescript": "^6.0.3",
63
+ "vite": "^8.1.2",
64
+ "vite-plugin-singlefile": "^2.3.3"
62
65
  }
63
66
  }
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.14.5](https://github.com/nodemailer/mailparser/compare/v3.14.4...v3.14.5) (2026-11-16)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * move link detection to linkify-it 6 ([6527e91](https://github.com/nodemailer/mailparser/commit/6527e9131c5a58a0497d2990cfae2bcf7e58ab13))
9
+
10
+ ## [3.14.4](https://github.com/nodemailer/mailparser/compare/v3.14.3...v3.14.4) (2026-11-15)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * update dependencies ([bc39266](https://github.com/nodemailer/mailparser/commit/bc39266c22fcd6156a2f5c4c81e84c72f1813ecd))
16
+
3
17
  ## [3.14.3](https://github.com/nodemailer/mailparser/compare/v3.14.2...v3.14.3) (2026-11-10)
4
18
 
5
19
 
@@ -8,7 +8,7 @@ const flowed_decoder_js_1 = __importDefault(require("@zone-eu/mailsplit/lib/flow
8
8
  const he_1 = __importDefault(require("he"));
9
9
  const html_to_text_1 = require("html-to-text");
10
10
  const libmime_1 = __importDefault(require("libmime"));
11
- const linkify_it_1 = __importDefault(require("linkify-it"));
11
+ const linkify_it_1 = require("linkify-it");
12
12
  const addressparser_1 = __importDefault(require("nodemailer/lib/addressparser"));
13
13
  const node_stream_1 = require("node:stream");
14
14
  const tlds_cjs_1 = __importDefault(require("./tlds.cjs"));
@@ -41,13 +41,32 @@ const MAX_LINKIFY_WORK = 768 * 1024 * 1024; // shared by all text parts of a mes
41
41
  const MAX_INLINED_IMAGES_SIZE = 20 * 1024 * 1024;
42
42
  // List-* header names that must not become keys of the plain list object
43
43
  const UNSAFE_LIST_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
44
- const linkify = (0, linkify_it_1.default)();
44
+ // Characters linkify-it 6 accepts in the local part of a schemaless address, less the slash, and
45
+ // less the apostrophe as the first character. With them a path such as
46
+ // usr/lib/addons/langpack-de@firefox.example.com/install.rdf, or a quoted
47
+ // 'user@example.com', became a mailto: link that started with the slash path or the
48
+ // quote. linkify-it 5 never linked either, and an apostrophe inside a name (o'brien@...) still works.
49
+ const MAIL_NAME_CHARS = '-!#$%&*+=?^_`{|}~a-zA-Z0-9';
50
+ const MAIL_NAME = new RegExp(`[${MAIL_NAME_CHARS}](?:[${MAIL_NAME_CHARS}']|[.](?=[${MAIL_NAME_CHARS}'])){0,63}`);
51
+ class MailNameREBuilder extends linkify_it_1.REBuilder {
52
+ get_mail_name() {
53
+ return MAIL_NAME;
54
+ }
55
+ }
56
+ const linkify = new linkify_it_1.LinkifyIt({
57
+ // links without a scheme (example.com, www.example.org), which linkify-it 6 no longer finds by default
58
+ fuzzyLink: true,
59
+ fuzzyEmail: true,
60
+ fuzzyIP: true,
61
+ // user:password@ in a URL stays part of the link, as it always was before linkify-it 6
62
+ urlAuth: true,
63
+ rebuilder: new MailNameREBuilder()
64
+ });
45
65
  linkify
46
66
  .tlds(tlds_cjs_1.default) // Reload with full tlds list
47
67
  .tlds('onion', true) // Add unofficial `.onion` domain
48
- .add('git:', 'http:') // Add `git:` ptotocol as "alias"
49
- .add('ftp:', null) // Disable `ftp:` ptotocol
50
- .set({ fuzzyIP: true, fuzzyLink: true, fuzzyEmail: true });
68
+ .add('git:', { validate: (text, pos, self) => self.testSchemaAt(text, 'http:', pos) }) // `git:` links validate like `http:` ones
69
+ .add('ftp:', null); // Disable `ftp:` protocol
51
70
  // Characters linkify-it accepts inside a host name: letters, digits, a dash,
52
71
  // and anything non-ASCII (its label pattern takes any character that is not
53
72
  // punctuation, whitespace or a control character).
@@ -56,19 +75,21 @@ function isHostChar(code) {
56
75
  }
57
76
  // twitter linkifier from
58
77
  // https://github.com/markdown-it/linkify-it#example-2-add-twitter-mentions-handler
78
+ let twitterHandle;
59
79
  linkify.add('@', {
60
80
  validate(text, pos, self) {
61
81
  let tail = text.slice(pos);
62
- if (!self.re.twitter) {
63
- self.re.twitter = new RegExp('^([a-zA-Z0-9_]){1,15}(?!_)(?=$|' + self.re.src_ZPCc + ')');
82
+ if (!twitterHandle) {
83
+ twitterHandle = new RegExp('^([a-zA-Z0-9_]){1,15}(?!_)(?=$|' + self.re.src_ZPCc + ')');
64
84
  }
65
- if (self.re.twitter.test(tail)) {
85
+ let handle = tail.match(twitterHandle);
86
+ if (handle) {
66
87
  // Linkifier allows punctuation chars before prefix,
67
88
  // but we additionally disable `@` ("@@mention" is invalid)
68
89
  if (pos >= 2 && text[pos - 2] === '@') {
69
- return false;
90
+ return 0;
70
91
  }
71
- return tail.match(self.re.twitter)[0].length;
92
+ return handle[0].length;
72
93
  }
73
94
  return 0;
74
95
  },
@@ -1142,9 +1163,8 @@ class MailParser extends node_stream_1.Transform {
1142
1163
  setImmediate(processNext);
1143
1164
  }
1144
1165
  // Tells whether a text segment is worth handing to linkify-it, see
1145
- // MAX_LINKIFY_* above. Note that linkify.pretest() can not be used for this
1146
- // - it is a quick deny that also denies links its own matcher finds, eg. a
1147
- // host followed by a fullwidth vertical bar.
1166
+ // MAX_LINKIFY_* above. It is also the only quick deny: linkify-it 6 has no
1167
+ // pretest(), and its test() is a full scan, as expensive as match().
1148
1168
  /** @internal */
1149
1169
  canScanSegment(segment) {
1150
1170
  // every link linkify-it can find contains at least one of these
@@ -1171,7 +1191,7 @@ class MailParser extends node_stream_1.Transform {
1171
1191
  /** @internal */
1172
1192
  findLinks(str) {
1173
1193
  let links = [];
1174
- if (this.linkifyWork >= MAX_LINKIFY_WORK || !linkify.pretest(str)) {
1194
+ if (this.linkifyWork >= MAX_LINKIFY_WORK) {
1175
1195
  return links;
1176
1196
  }
1177
1197
  // Whitespace can not be part of a link and linkify-it treats the end of
@@ -3,7 +3,7 @@ import FlowedDecoder from '@zone-eu/mailsplit/lib/flowed-decoder.js';
3
3
  import he from 'he';
4
4
  import { htmlToText } from 'html-to-text';
5
5
  import libmime from 'libmime';
6
- import linkifyIt from 'linkify-it';
6
+ import { LinkifyIt, REBuilder } from 'linkify-it';
7
7
  import addressparser from 'nodemailer/lib/addressparser';
8
8
  import { Transform } from 'node:stream';
9
9
  import tlds from './tlds.cjs';
@@ -36,13 +36,32 @@ const MAX_LINKIFY_WORK = 768 * 1024 * 1024; // shared by all text parts of a mes
36
36
  const MAX_INLINED_IMAGES_SIZE = 20 * 1024 * 1024;
37
37
  // List-* header names that must not become keys of the plain list object
38
38
  const UNSAFE_LIST_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
39
- const linkify = linkifyIt();
39
+ // Characters linkify-it 6 accepts in the local part of a schemaless address, less the slash, and
40
+ // less the apostrophe as the first character. With them a path such as
41
+ // usr/lib/addons/langpack-de@firefox.example.com/install.rdf, or a quoted
42
+ // 'user@example.com', became a mailto: link that started with the slash path or the
43
+ // quote. linkify-it 5 never linked either, and an apostrophe inside a name (o'brien@...) still works.
44
+ const MAIL_NAME_CHARS = '-!#$%&*+=?^_`{|}~a-zA-Z0-9';
45
+ const MAIL_NAME = new RegExp(`[${MAIL_NAME_CHARS}](?:[${MAIL_NAME_CHARS}']|[.](?=[${MAIL_NAME_CHARS}'])){0,63}`);
46
+ class MailNameREBuilder extends REBuilder {
47
+ get_mail_name() {
48
+ return MAIL_NAME;
49
+ }
50
+ }
51
+ const linkify = new LinkifyIt({
52
+ // links without a scheme (example.com, www.example.org), which linkify-it 6 no longer finds by default
53
+ fuzzyLink: true,
54
+ fuzzyEmail: true,
55
+ fuzzyIP: true,
56
+ // user:password@ in a URL stays part of the link, as it always was before linkify-it 6
57
+ urlAuth: true,
58
+ rebuilder: new MailNameREBuilder()
59
+ });
40
60
  linkify
41
61
  .tlds(tlds) // Reload with full tlds list
42
62
  .tlds('onion', true) // Add unofficial `.onion` domain
43
- .add('git:', 'http:') // Add `git:` ptotocol as "alias"
44
- .add('ftp:', null) // Disable `ftp:` ptotocol
45
- .set({ fuzzyIP: true, fuzzyLink: true, fuzzyEmail: true });
63
+ .add('git:', { validate: (text, pos, self) => self.testSchemaAt(text, 'http:', pos) }) // `git:` links validate like `http:` ones
64
+ .add('ftp:', null); // Disable `ftp:` protocol
46
65
  // Characters linkify-it accepts inside a host name: letters, digits, a dash,
47
66
  // and anything non-ASCII (its label pattern takes any character that is not
48
67
  // punctuation, whitespace or a control character).
@@ -51,19 +70,21 @@ function isHostChar(code) {
51
70
  }
52
71
  // twitter linkifier from
53
72
  // https://github.com/markdown-it/linkify-it#example-2-add-twitter-mentions-handler
73
+ let twitterHandle;
54
74
  linkify.add('@', {
55
75
  validate(text, pos, self) {
56
76
  let tail = text.slice(pos);
57
- if (!self.re.twitter) {
58
- self.re.twitter = new RegExp('^([a-zA-Z0-9_]){1,15}(?!_)(?=$|' + self.re.src_ZPCc + ')');
77
+ if (!twitterHandle) {
78
+ twitterHandle = new RegExp('^([a-zA-Z0-9_]){1,15}(?!_)(?=$|' + self.re.src_ZPCc + ')');
59
79
  }
60
- if (self.re.twitter.test(tail)) {
80
+ let handle = tail.match(twitterHandle);
81
+ if (handle) {
61
82
  // Linkifier allows punctuation chars before prefix,
62
83
  // but we additionally disable `@` ("@@mention" is invalid)
63
84
  if (pos >= 2 && text[pos - 2] === '@') {
64
- return false;
85
+ return 0;
65
86
  }
66
- return tail.match(self.re.twitter)[0].length;
87
+ return handle[0].length;
67
88
  }
68
89
  return 0;
69
90
  },
@@ -1137,9 +1158,8 @@ class MailParser extends Transform {
1137
1158
  setImmediate(processNext);
1138
1159
  }
1139
1160
  // Tells whether a text segment is worth handing to linkify-it, see
1140
- // MAX_LINKIFY_* above. Note that linkify.pretest() can not be used for this
1141
- // - it is a quick deny that also denies links its own matcher finds, eg. a
1142
- // host followed by a fullwidth vertical bar.
1161
+ // MAX_LINKIFY_* above. It is also the only quick deny: linkify-it 6 has no
1162
+ // pretest(), and its test() is a full scan, as expensive as match().
1143
1163
  /** @internal */
1144
1164
  canScanSegment(segment) {
1145
1165
  // every link linkify-it can find contains at least one of these
@@ -1166,7 +1186,7 @@ class MailParser extends Transform {
1166
1186
  /** @internal */
1167
1187
  findLinks(str) {
1168
1188
  let links = [];
1169
- if (this.linkifyWork >= MAX_LINKIFY_WORK || !linkify.pretest(str)) {
1189
+ if (this.linkifyWork >= MAX_LINKIFY_WORK) {
1170
1190
  return links;
1171
1191
  }
1172
1192
  // Whitespace can not be part of a link and linkify-it treats the end of
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailparser",
3
- "version": "3.14.3",
3
+ "version": "3.14.5",
4
4
  "description": "Parse e-mails",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -92,24 +92,24 @@
92
92
  ],
93
93
  "license": "MIT",
94
94
  "dependencies": {
95
- "@zone-eu/mailsplit": "5.4.30",
95
+ "@zone-eu/mailsplit": "5.4.31",
96
96
  "he": "1.2.0",
97
97
  "html-to-text": "10.0.1",
98
- "libmime": "5.6.4",
99
- "linkify-it": "5.0.2",
100
- "nodemailer": "10.5.0",
98
+ "libmime": "5.6.5",
99
+ "linkify-it": "6.1.0",
100
+ "nodemailer": "10.6.0",
101
101
  "punycode.js": "2.3.1",
102
102
  "tlds": "1.261.0"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@types/node": "20.19.43",
106
106
  "c8": "12.0.0",
107
- "eslint": "10.14.0",
107
+ "eslint": "10.15.0",
108
108
  "eslint-config-prettier": "10.1.8",
109
109
  "globals": "17.14.0",
110
110
  "iconv": "3.0.1",
111
111
  "iconv-lite": "0.7.3",
112
- "prettier": "3.9.10",
112
+ "prettier": "3.10.1",
113
113
  "tsx": "4.23.15",
114
114
  "typescript": "6.0.3",
115
115
  "typescript-eslint": "8.72.2"
@@ -126,5 +126,9 @@
126
126
  },
127
127
  "allowScripts": {
128
128
  "iconv": true
129
+ },
130
+ "overrides": {
131
+ "glob": "14.0.6",
132
+ "minimatch": "11.0.8"
129
133
  }
130
134
  }
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [10.6.0](https://github.com/nodemailer/nodemailer/compare/v10.5.0...v10.6.0) (2026-11-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * **smtp:** add configurable socketCloseTimeout ([#1916](https://github.com/nodemailer/nodemailer/issues/1916)) ([7f04d0b](https://github.com/nodemailer/nodemailer/commit/7f04d0b78e887191c89775cf4a3063462b222aad)), closes [#1915](https://github.com/nodemailer/nodemailer/issues/1915)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * let Set-Cookie Max-Age take precedence over Expires ([#1917](https://github.com/nodemailer/nodemailer/issues/1917)) ([d6d6d44](https://github.com/nodemailer/nodemailer/commit/d6d6d44f5fbdf61936032d8865a1312c89c1804e))
14
+ * **smtp-connection:** close the TLS socket of an upgraded connection on Node 27 ([4135015](https://github.com/nodemailer/nodemailer/commit/4135015175398aaad5ac6e1866e91a758c432417))
15
+
3
16
  ## [10.5.0](https://github.com/nodemailer/nodemailer/compare/v10.4.1...v10.5.0) (2026-11-10)
4
17
 
5
18
 
@@ -35,6 +35,10 @@ Work already started by a plugin or a custom `getSocket` hook requires that code
35
35
 
36
36
  Other bundled transports (stream, JSON, sendmail and SES) ignore the signal once the message is handed to them, so the message is sent normally. A signal that is already aborted, or aborts while plugins run, still cancels the send with `EABORT` on every transport, as that happens before the transport is called. A `signal` value that is not an `AbortSignal` fails the send with `ECONFIG`. Custom transports can opt in with `supportsAbortSignal: true`; their `send()` must register its abort listener synchronously, check for a pre-aborted signal, stop the work it owns, invoke its callback once, and remove the listener on completion.
37
37
 
38
+ ## SMTP socket close timeout
39
+
40
+ When an SMTP connection closes, Nodemailer ends the socket and destroys it if the server has not closed its side within `socketCloseTimeout` milliseconds (default 5000). Set it to `0` to destroy the socket right away. This applies to SMTP and pooled SMTP, including aborted sends and `transporter.close({ force: true })`. It does not tell you whether the server accepted a message that was in flight.
41
+
38
42
  ## Having an issue?
39
43
 
40
44
  #### First review the docs
@@ -131,6 +131,7 @@ class Cookies {
131
131
  parse(cookieStr) {
132
132
  const cookie = {};
133
133
  let hasNameValue = false;
134
+ let hasMaxAge = false;
134
135
  (cookieStr || '')
135
136
  .toString()
136
137
  .split(';')
@@ -158,7 +159,8 @@ class Cookies {
158
159
  case 'expires': {
159
160
  const expires = new Date(value);
160
161
  // ignore date if can not parse it
161
- if (expires.toString() !== 'Invalid Date') {
162
+ if (expires.toString() !== 'Invalid Date' && !hasMaxAge) {
163
+ // Max-Age has precedence when both attributes are present (RFC 6265 5.3)
162
164
  cookie.expires = expires;
163
165
  }
164
166
  break;
@@ -175,6 +177,7 @@ class Cookies {
175
177
  break;
176
178
  case 'max-age':
177
179
  cookie.expires = new Date(Date.now() + (Number(value) || 0) * 1000);
180
+ hasMaxAge = true;
178
181
  break;
179
182
  case 'secure':
180
183
  cookie.secure = true;
@@ -1,3 +1,3 @@
1
1
  export declare const name = "nodemailer";
2
- export declare const version = "10.5.0";
2
+ export declare const version = "10.6.0";
3
3
  export declare const homepage = "https://nodemailer.com/";
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.homepage = exports.version = exports.name = void 0;
5
5
  exports.name = 'nodemailer';
6
- exports.version = '10.5.0';
6
+ exports.version = '10.6.0';
7
7
  exports.homepage = 'https://nodemailer.com/';
@@ -42,6 +42,8 @@ export interface SMTPConnectionOptions {
42
42
  greetingTimeout?: number | undefined;
43
43
  /** Time of inactivity in ms until the connection is closed, defaults to 10 minutes */
44
44
  socketTimeout?: number | undefined;
45
+ /** Time in ms to wait for the peer to close after ending the socket, defaults to 5 seconds. Set to 0 to destroy it immediately */
46
+ socketCloseTimeout?: number | undefined;
45
47
  /** Largest single server response to accept in bytes, defaults to 1 MB */
46
48
  maxResponseSize?: number | undefined;
47
49
  /** Time to wait in ms for the DNS requests to be resolved, defaults to 30 seconds */
@@ -307,6 +309,7 @@ export type SMTPConnectionResponseAction = (str: string) => void;
307
309
  * * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 30 seconds)
308
310
  * * **connectionTimeout** - how many milliseconds to wait for the connection to establish (defaults to 2 minutes)
309
311
  * * **socketTimeout** - Time of inactivity until the connection is closed (defaults to 10 minutes)
312
+ * * **socketCloseTimeout** - Time in ms to wait for the peer to close after ending the socket (defaults to 5 seconds, 0 destroys immediately)
310
313
  * * **maxResponseSize** - Largest single server response to accept in bytes (defaults to 1 MB)
311
314
  * * **dnsTimeout** - Time to wait in ms for the DNS requests to be resolved (defaults to 30 seconds)
312
315
  * * **lmtp** - if true, uses LMTP instead of SMTP protocol
@@ -145,6 +145,7 @@ function maskAuthCommand(cmd) {
145
145
  * * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 30 seconds)
146
146
  * * **connectionTimeout** - how many milliseconds to wait for the connection to establish (defaults to 2 minutes)
147
147
  * * **socketTimeout** - Time of inactivity until the connection is closed (defaults to 10 minutes)
148
+ * * **socketCloseTimeout** - Time in ms to wait for the peer to close after ending the socket (defaults to 5 seconds, 0 destroys immediately)
148
149
  * * **maxResponseSize** - Largest single server response to accept in bytes (defaults to 1 MB)
149
150
  * * **dnsTimeout** - Time to wait in ms for the DNS requests to be resolved (defaults to 30 seconds)
150
151
  * * **lmtp** - if true, uses LMTP instead of SMTP protocol
@@ -468,11 +469,18 @@ class SMTPConnection extends node_events_1.EventEmitter {
468
469
  return;
469
470
  }
470
471
  this._closing = true;
471
- const closeMethod = this.stage === 'init' ? 'destroy' : 'end';
472
+ // anything but a non-negative finite number keeps the default grace period
473
+ const configuredCloseTimeout = this.options.socketCloseTimeout;
474
+ const socketCloseTimeout = typeof configuredCloseTimeout === 'number' && Number.isFinite(configuredCloseTimeout) && configuredCloseTimeout >= 0
475
+ ? configuredCloseTimeout
476
+ : CLOSE_TIMEOUT;
477
+ const closeMethod = this.stage === 'init' || socketCloseTimeout === 0 ? 'destroy' : 'end';
472
478
  this.logger.debug({
473
479
  tnx: 'smtp'
474
480
  }, 'Closing connection to the server using "%s"', closeMethod);
475
- const socket = (this._socket && this._socket.socket) || this._socket;
481
+ // after STARTTLS this is the TLS socket, tear that one down and not the plain socket it
482
+ // wraps (Node 27 exposes the wrapped socket as `.socket`)
483
+ const socket = this._socket;
476
484
  // Detach any in-flight DATA stream from the socket so the source stream
477
485
  // can be garbage-collected once the socket is gone.
478
486
  if (this._currentDataStream) {
@@ -514,7 +522,7 @@ class SMTPConnection extends node_events_1.EventEmitter {
514
522
  if (closeMethod === 'end') {
515
523
  // end() only closes our side, a server that never closes its own would keep
516
524
  // the socket, and the process with it, around for good
517
- const closeTimer = setTimeout(() => socket.destroy(), CLOSE_TIMEOUT);
525
+ const closeTimer = setTimeout(() => socket.destroy(), socketCloseTimeout);
518
526
  if (typeof closeTimer.unref === 'function') {
519
527
  closeTimer.unref();
520
528
  }
@@ -93,6 +93,7 @@ class Cookies {
93
93
  parse(cookieStr) {
94
94
  const cookie = {};
95
95
  let hasNameValue = false;
96
+ let hasMaxAge = false;
96
97
  (cookieStr || '')
97
98
  .toString()
98
99
  .split(';')
@@ -120,7 +121,8 @@ class Cookies {
120
121
  case 'expires': {
121
122
  const expires = new Date(value);
122
123
  // ignore date if can not parse it
123
- if (expires.toString() !== 'Invalid Date') {
124
+ if (expires.toString() !== 'Invalid Date' && !hasMaxAge) {
125
+ // Max-Age has precedence when both attributes are present (RFC 6265 5.3)
124
126
  cookie.expires = expires;
125
127
  }
126
128
  break;
@@ -137,6 +139,7 @@ class Cookies {
137
139
  break;
138
140
  case 'max-age':
139
141
  cookie.expires = new Date(Date.now() + (Number(value) || 0) * 1000);
142
+ hasMaxAge = true;
140
143
  break;
141
144
  case 'secure':
142
145
  cookie.secure = true;
@@ -1,3 +1,3 @@
1
1
  export declare const name = "nodemailer";
2
- export declare const version = "10.5.0";
2
+ export declare const version = "10.6.0";
3
3
  export declare const homepage = "https://nodemailer.com/";
@@ -1,4 +1,4 @@
1
1
  // Generated by scripts/build.js from package.json. Do not edit by hand.
2
2
  export const name = 'nodemailer';
3
- export const version = '10.5.0';
3
+ export const version = '10.6.0';
4
4
  export const homepage = 'https://nodemailer.com/';
@@ -42,6 +42,8 @@ export interface SMTPConnectionOptions {
42
42
  greetingTimeout?: number | undefined;
43
43
  /** Time of inactivity in ms until the connection is closed, defaults to 10 minutes */
44
44
  socketTimeout?: number | undefined;
45
+ /** Time in ms to wait for the peer to close after ending the socket, defaults to 5 seconds. Set to 0 to destroy it immediately */
46
+ socketCloseTimeout?: number | undefined;
45
47
  /** Largest single server response to accept in bytes, defaults to 1 MB */
46
48
  maxResponseSize?: number | undefined;
47
49
  /** Time to wait in ms for the DNS requests to be resolved, defaults to 30 seconds */
@@ -307,6 +309,7 @@ export type SMTPConnectionResponseAction = (str: string) => void;
307
309
  * * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 30 seconds)
308
310
  * * **connectionTimeout** - how many milliseconds to wait for the connection to establish (defaults to 2 minutes)
309
311
  * * **socketTimeout** - Time of inactivity until the connection is closed (defaults to 10 minutes)
312
+ * * **socketCloseTimeout** - Time in ms to wait for the peer to close after ending the socket (defaults to 5 seconds, 0 destroys immediately)
310
313
  * * **maxResponseSize** - Largest single server response to accept in bytes (defaults to 1 MB)
311
314
  * * **dnsTimeout** - Time to wait in ms for the DNS requests to be resolved (defaults to 30 seconds)
312
315
  * * **lmtp** - if true, uses LMTP instead of SMTP protocol
@@ -107,6 +107,7 @@ function maskAuthCommand(cmd) {
107
107
  * * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 30 seconds)
108
108
  * * **connectionTimeout** - how many milliseconds to wait for the connection to establish (defaults to 2 minutes)
109
109
  * * **socketTimeout** - Time of inactivity until the connection is closed (defaults to 10 minutes)
110
+ * * **socketCloseTimeout** - Time in ms to wait for the peer to close after ending the socket (defaults to 5 seconds, 0 destroys immediately)
110
111
  * * **maxResponseSize** - Largest single server response to accept in bytes (defaults to 1 MB)
111
112
  * * **dnsTimeout** - Time to wait in ms for the DNS requests to be resolved (defaults to 30 seconds)
112
113
  * * **lmtp** - if true, uses LMTP instead of SMTP protocol
@@ -430,11 +431,18 @@ class SMTPConnection extends EventEmitter {
430
431
  return;
431
432
  }
432
433
  this._closing = true;
433
- const closeMethod = this.stage === 'init' ? 'destroy' : 'end';
434
+ // anything but a non-negative finite number keeps the default grace period
435
+ const configuredCloseTimeout = this.options.socketCloseTimeout;
436
+ const socketCloseTimeout = typeof configuredCloseTimeout === 'number' && Number.isFinite(configuredCloseTimeout) && configuredCloseTimeout >= 0
437
+ ? configuredCloseTimeout
438
+ : CLOSE_TIMEOUT;
439
+ const closeMethod = this.stage === 'init' || socketCloseTimeout === 0 ? 'destroy' : 'end';
434
440
  this.logger.debug({
435
441
  tnx: 'smtp'
436
442
  }, 'Closing connection to the server using "%s"', closeMethod);
437
- const socket = (this._socket && this._socket.socket) || this._socket;
443
+ // after STARTTLS this is the TLS socket, tear that one down and not the plain socket it
444
+ // wraps (Node 27 exposes the wrapped socket as `.socket`)
445
+ const socket = this._socket;
438
446
  // Detach any in-flight DATA stream from the socket so the source stream
439
447
  // can be garbage-collected once the socket is gone.
440
448
  if (this._currentDataStream) {
@@ -476,7 +484,7 @@ class SMTPConnection extends EventEmitter {
476
484
  if (closeMethod === 'end') {
477
485
  // end() only closes our side, a server that never closes its own would keep
478
486
  // the socket, and the process with it, around for good
479
- const closeTimer = setTimeout(() => socket.destroy(), CLOSE_TIMEOUT);
487
+ const closeTimer = setTimeout(() => socket.destroy(), socketCloseTimeout);
480
488
  if (typeof closeTimer.unref === 'function') {
481
489
  closeTimer.unref();
482
490
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodemailer",
3
- "version": "10.5.0",
3
+ "version": "10.6.0",
4
4
  "description": "Easy as cake e-mail sending from your Node.js applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/nodemailer.js",
@@ -132,6 +132,7 @@
132
132
  "test:cjs": "NODE_OPTIONS=--no-experimental-require-module node test/package/cjs-smoke.cjs",
133
133
  "pretest:bun": "npm run build",
134
134
  "test:bun": "bun test --timeout 60000 $(find ./test \\( -name '*-test.ts' -o -name '*.test.ts' \\))",
135
+ "fuzz:addressparser": "node --import tsx scripts/fuzz-addressparser.js",
135
136
  "format": "prettier --write \"**/*.{js,cjs,ts,json,md}\"",
136
137
  "format:check": "prettier --check \"**/*.{js,cjs,ts,json,md}\"",
137
138
  "lint": "eslint . && npm run typecheck",
@@ -153,26 +154,30 @@
153
154
  },
154
155
  "homepage": "https://nodemailer.com/",
155
156
  "devDependencies": {
156
- "@aws-sdk/client-sesv2": "3.1165.0",
157
+ "@aws-sdk/client-sesv2": "3.1169.0",
157
158
  "@types/node": "20.19.43",
158
159
  "bunyan": "1.8.15",
159
160
  "c8": "12.0.0",
160
- "eslint": "10.14.0",
161
+ "eslint": "10.15.0",
161
162
  "eslint-config-prettier": "10.1.8",
162
163
  "globals": "17.14.0",
163
164
  "libbase64": "1.4.1",
164
165
  "libmime": "5.6.4",
165
166
  "libqp": "3.0.1",
166
- "mailauth": "8.0.4",
167
- "prettier": "3.9.10",
167
+ "mailauth": "8.0.6",
168
+ "prettier": "3.10.1",
168
169
  "proxy": "1.0.2",
169
170
  "proxy-test-server": "1.0.0",
170
- "smtp-server": "3.21.3",
171
+ "smtp-server": "3.21.4",
171
172
  "tsx": "4.23.15",
172
173
  "typescript": "6.0.3",
173
174
  "typescript-eslint": "8.72.2"
174
175
  },
175
176
  "engines": {
176
177
  "node": ">=20.0.0"
178
+ },
179
+ "overrides": {
180
+ "glob": "14.0.6",
181
+ "minimatch": "11.0.8"
177
182
  }
178
183
  }