@mavogel/awscdk-rootmail 0.1.4 → 0.1.6

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 (195) hide show
  1. package/.jsii +3 -3
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/node_modules/@aws-sdk/checksums/package.json +2 -2
  5. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
  6. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +3 -3
  7. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
  8. package/node_modules/@aws-sdk/client-route-53/package.json +3 -3
  9. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +38 -15
  10. package/node_modules/@aws-sdk/client-s3/dist-es/models/enums.js +7 -0
  11. package/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js +28 -14
  12. package/node_modules/@aws-sdk/client-s3/dist-types/commands/CopyObjectCommand.d.ts +3 -0
  13. package/node_modules/@aws-sdk/client-s3/dist-types/commands/CreateMultipartUploadCommand.d.ts +3 -0
  14. package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetBucketInventoryConfigurationCommand.d.ts +1 -1
  15. package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetBucketNotificationConfigurationCommand.d.ts +3 -3
  16. package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetObjectCommand.d.ts +3 -0
  17. package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetObjectLockConfigurationCommand.d.ts +4 -0
  18. package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetObjectRetentionCommand.d.ts +5 -0
  19. package/node_modules/@aws-sdk/client-s3/dist-types/commands/HeadObjectCommand.d.ts +3 -0
  20. package/node_modules/@aws-sdk/client-s3/dist-types/commands/ListBucketInventoryConfigurationsCommand.d.ts +1 -1
  21. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutBucketInventoryConfigurationCommand.d.ts +1 -1
  22. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutBucketNotificationConfigurationCommand.d.ts +3 -3
  23. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutObjectCommand.d.ts +3 -0
  24. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutObjectLockConfigurationCommand.d.ts +4 -0
  25. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutObjectRetentionCommand.d.ts +5 -0
  26. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutPublicAccessBlockCommand.d.ts +1 -1
  27. package/node_modules/@aws-sdk/client-s3/dist-types/models/enums.d.ts +15 -0
  28. package/node_modules/@aws-sdk/client-s3/dist-types/models/models_0.d.ts +186 -49
  29. package/node_modules/@aws-sdk/client-s3/dist-types/models/models_1.d.ts +43 -1
  30. package/node_modules/@aws-sdk/client-s3/dist-types/schemas/schemas_0.d.ts +1 -0
  31. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/commands/PutPublicAccessBlockCommand.d.ts +1 -1
  32. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/enums.d.ts +8 -0
  33. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/models_0.d.ts +23 -7
  34. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/models_1.d.ts +14 -1
  35. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/schemas/schemas_0.d.ts +1 -0
  36. package/node_modules/@aws-sdk/client-s3/package.json +6 -6
  37. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
  38. package/node_modules/@aws-sdk/client-ses/package.json +3 -3
  39. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
  40. package/node_modules/@aws-sdk/client-ssm/package.json +3 -3
  41. package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +5 -0
  42. package/node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js +3 -0
  43. package/node_modules/@aws-sdk/core/dist-es/submodules/util/index.js +1 -0
  44. package/node_modules/@aws-sdk/core/dist-types/submodules/util/hasOwn.d.ts +4 -0
  45. package/node_modules/@aws-sdk/core/dist-types/submodules/util/index.d.ts +1 -0
  46. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/hasOwn.d.ts +1 -0
  47. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +1 -0
  48. package/node_modules/@aws-sdk/core/package.json +1 -1
  49. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  50. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  51. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  52. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  53. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  54. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  55. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  56. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  57. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +2 -2
  58. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  59. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  60. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  61. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  62. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  63. package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
  64. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  65. package/node_modules/@zone-eu/mailsplit/package.json +3 -3
  66. package/node_modules/encoding-japanese/LICENSE +25 -1
  67. package/node_modules/encoding-japanese/README.md +86 -51
  68. package/node_modules/encoding-japanese/encoding.js +107 -78
  69. package/node_modules/encoding-japanese/encoding.min.js +2 -2
  70. package/node_modules/encoding-japanese/index.d.ts +102 -0
  71. package/node_modules/encoding-japanese/package.json +26 -17
  72. package/node_modules/encoding-japanese/src/encoding-convert.js +67 -58
  73. package/node_modules/encoding-japanese/src/encoding-table.js +1 -0
  74. package/node_modules/encoding-japanese/src/index.js +1 -1
  75. package/node_modules/encoding-japanese/src/kana-case-table.js +1 -1
  76. package/node_modules/encoding-japanese/src/utf8-to-jis-alias-table.js +14 -0
  77. package/node_modules/encoding-japanese/src/utf8-to-jis-table.js +6 -5
  78. package/node_modules/encoding-japanese/src/utf8-to-jisx0212-table.js +7 -5
  79. package/node_modules/libmime/CHANGELOG.md +7 -0
  80. package/node_modules/libmime/package.json +2 -2
  81. package/node_modules/mailparser/.release-please-manifest.json +1 -1
  82. package/node_modules/mailparser/CHANGELOG.md +42 -0
  83. package/node_modules/mailparser/package.json +5 -5
  84. package/node_modules/nodemailer/CHANGELOG.md +83 -0
  85. package/node_modules/nodemailer/dist/cjs/addressparser/index.d.ts +1 -3
  86. package/node_modules/nodemailer/dist/cjs/addressparser/index.js +176 -13
  87. package/node_modules/nodemailer/dist/cjs/base64/index.d.ts +2 -6
  88. package/node_modules/nodemailer/dist/cjs/base64/index.js +2 -0
  89. package/node_modules/nodemailer/dist/cjs/dkim/index.d.ts +4 -4
  90. package/node_modules/nodemailer/dist/cjs/dkim/message-parser.d.ts +1 -3
  91. package/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +14 -5
  92. package/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.d.ts +3 -22
  93. package/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.js +5 -0
  94. package/node_modules/nodemailer/dist/cjs/dkim/sign.d.ts +5 -5
  95. package/node_modules/nodemailer/dist/cjs/errors.d.ts +8 -8
  96. package/node_modules/nodemailer/dist/cjs/fetch/cookies.d.ts +12 -10
  97. package/node_modules/nodemailer/dist/cjs/fetch/cookies.js +28 -14
  98. package/node_modules/nodemailer/dist/cjs/fetch/index.d.ts +15 -15
  99. package/node_modules/nodemailer/dist/cjs/json-transport/index.d.ts +2 -2
  100. package/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +49 -104
  101. package/node_modules/nodemailer/dist/cjs/mail-composer/index.js +14 -3
  102. package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +21 -28
  103. package/node_modules/nodemailer/dist/cjs/mailer/index.js +19 -5
  104. package/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +8 -12
  105. package/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +4 -1
  106. package/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +1 -1
  107. package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +4 -1
  108. package/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +37 -191
  109. package/node_modules/nodemailer/dist/cjs/mime-node/index.js +82 -12
  110. package/node_modules/nodemailer/dist/cjs/mime-node/last-newline.d.ts +1 -3
  111. package/node_modules/nodemailer/dist/cjs/mime-node/last-newline.js +2 -0
  112. package/node_modules/nodemailer/dist/cjs/mime-node/le-unix.d.ts +1 -5
  113. package/node_modules/nodemailer/dist/cjs/mime-node/le-unix.js +1 -0
  114. package/node_modules/nodemailer/dist/cjs/mime-node/le-windows.d.ts +1 -5
  115. package/node_modules/nodemailer/dist/cjs/mime-node/le-windows.js +1 -0
  116. package/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +2 -2
  117. package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
  118. package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
  119. package/node_modules/nodemailer/dist/cjs/qp/index.d.ts +2 -5
  120. package/node_modules/nodemailer/dist/cjs/qp/index.js +2 -0
  121. package/node_modules/nodemailer/dist/cjs/sendmail-transport/index.d.ts +4 -6
  122. package/node_modules/nodemailer/dist/cjs/ses-transport/index.d.ts +2 -2
  123. package/node_modules/nodemailer/dist/cjs/ses-transport/index.js +5 -1
  124. package/node_modules/nodemailer/dist/cjs/shared/index.d.ts +31 -37
  125. package/node_modules/nodemailer/dist/cjs/shared/index.js +19 -7
  126. package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.d.ts +1 -9
  127. package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.js +2 -0
  128. package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +1 -1
  129. package/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +65 -403
  130. package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +99 -19
  131. package/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +8 -46
  132. package/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +13 -2
  133. package/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.d.ts +2 -4
  134. package/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +16 -16
  135. package/node_modules/nodemailer/dist/cjs/stream-transport/index.d.ts +3 -3
  136. package/node_modules/nodemailer/dist/cjs/well-known/index.d.ts +9 -9
  137. package/node_modules/nodemailer/dist/cjs/well-known/services.js +2 -0
  138. package/node_modules/nodemailer/dist/cjs/xoauth2/index.d.ts +18 -18
  139. package/node_modules/nodemailer/dist/esm/addressparser/index.d.ts +1 -3
  140. package/node_modules/nodemailer/dist/esm/addressparser/index.js +176 -13
  141. package/node_modules/nodemailer/dist/esm/base64/index.d.ts +2 -6
  142. package/node_modules/nodemailer/dist/esm/base64/index.js +2 -0
  143. package/node_modules/nodemailer/dist/esm/dkim/index.d.ts +4 -4
  144. package/node_modules/nodemailer/dist/esm/dkim/message-parser.d.ts +1 -3
  145. package/node_modules/nodemailer/dist/esm/dkim/message-parser.js +14 -5
  146. package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.d.ts +3 -22
  147. package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js +5 -0
  148. package/node_modules/nodemailer/dist/esm/dkim/sign.d.ts +5 -5
  149. package/node_modules/nodemailer/dist/esm/errors.d.ts +8 -8
  150. package/node_modules/nodemailer/dist/esm/fetch/cookies.d.ts +12 -10
  151. package/node_modules/nodemailer/dist/esm/fetch/cookies.js +25 -14
  152. package/node_modules/nodemailer/dist/esm/fetch/index.d.ts +15 -15
  153. package/node_modules/nodemailer/dist/esm/json-transport/index.d.ts +2 -2
  154. package/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +49 -104
  155. package/node_modules/nodemailer/dist/esm/mail-composer/index.js +14 -3
  156. package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +21 -28
  157. package/node_modules/nodemailer/dist/esm/mailer/index.js +19 -5
  158. package/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +8 -12
  159. package/node_modules/nodemailer/dist/esm/mailer/mail-message.js +4 -1
  160. package/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +1 -1
  161. package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +4 -1
  162. package/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +37 -191
  163. package/node_modules/nodemailer/dist/esm/mime-node/index.js +82 -12
  164. package/node_modules/nodemailer/dist/esm/mime-node/last-newline.d.ts +1 -3
  165. package/node_modules/nodemailer/dist/esm/mime-node/last-newline.js +2 -0
  166. package/node_modules/nodemailer/dist/esm/mime-node/le-unix.d.ts +1 -5
  167. package/node_modules/nodemailer/dist/esm/mime-node/le-unix.js +1 -0
  168. package/node_modules/nodemailer/dist/esm/mime-node/le-windows.d.ts +1 -5
  169. package/node_modules/nodemailer/dist/esm/mime-node/le-windows.js +1 -0
  170. package/node_modules/nodemailer/dist/esm/nodemailer.d.ts +2 -2
  171. package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
  172. package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
  173. package/node_modules/nodemailer/dist/esm/qp/index.d.ts +2 -5
  174. package/node_modules/nodemailer/dist/esm/qp/index.js +2 -0
  175. package/node_modules/nodemailer/dist/esm/sendmail-transport/index.d.ts +4 -6
  176. package/node_modules/nodemailer/dist/esm/ses-transport/index.d.ts +2 -2
  177. package/node_modules/nodemailer/dist/esm/ses-transport/index.js +5 -1
  178. package/node_modules/nodemailer/dist/esm/shared/index.d.ts +31 -37
  179. package/node_modules/nodemailer/dist/esm/shared/index.js +19 -7
  180. package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.d.ts +1 -9
  181. package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js +2 -0
  182. package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +1 -1
  183. package/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +65 -403
  184. package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +99 -19
  185. package/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +8 -46
  186. package/node_modules/nodemailer/dist/esm/smtp-pool/index.js +13 -2
  187. package/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.d.ts +2 -4
  188. package/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +16 -16
  189. package/node_modules/nodemailer/dist/esm/stream-transport/index.d.ts +3 -3
  190. package/node_modules/nodemailer/dist/esm/well-known/index.d.ts +9 -9
  191. package/node_modules/nodemailer/dist/esm/well-known/services.js +2 -0
  192. package/node_modules/nodemailer/dist/esm/xoauth2/index.d.ts +18 -18
  193. package/node_modules/nodemailer/dist/well-known/services.json +2 -2
  194. package/node_modules/nodemailer/package.json +6 -6
  195. package/package.json +1 -1
@@ -3,19 +3,19 @@
3
3
  */
4
4
  export interface CookiesOptions {
5
5
  /** Lifetime in seconds for cookies that do not set their own expiration (default 1800) */
6
- sessionTimeout?: number | string;
6
+ sessionTimeout?: number | string | undefined;
7
7
  }
8
8
  /**
9
9
  * A cookie as parsed from a 'Set-Cookie:' header and kept in the jar
10
10
  */
11
11
  export interface Cookie {
12
- name?: string;
13
- value?: string;
14
- domain?: string;
15
- path?: string;
16
- expires?: Date;
17
- secure?: boolean;
18
- httponly?: boolean;
12
+ name?: string | undefined;
13
+ value?: string | undefined;
14
+ domain?: string | undefined;
15
+ path?: string | undefined;
16
+ expires?: Date | undefined;
17
+ secure?: boolean | undefined;
18
+ httponly?: boolean | undefined;
19
19
  }
20
20
  /**
21
21
  * Creates a biskviit cookie jar for managing cookie values in memory
@@ -85,10 +85,12 @@ export default class Cookies {
85
85
  */
86
86
  isExpired(cookie: Cookie): boolean;
87
87
  /**
88
- * Returns normalized cookie path for an URL path argument
88
+ * Returns the default path for an URL path argument, the default-path of
89
+ * RFC 6265 section 5.1.4. A cookie that carries no Path attribute is scoped
90
+ * to the directory of the URL it was set from
89
91
  *
90
92
  * @param pathname
91
- * @returns Normalized path
93
+ * @returns Default path
92
94
  */
93
95
  getPath(pathname?: string | null): string;
94
96
  }
@@ -1,4 +1,5 @@
1
1
  // module to handle cookies
2
+ import net from 'node:net';
2
3
  import * as urllib from '../shared/url.js';
3
4
  const SESSION_TIMEOUT = 1800; // 30 min
4
5
  /**
@@ -24,12 +25,19 @@ export default class Cookies {
24
25
  let domain;
25
26
  if (cookie.domain) {
26
27
  domain = cookie.domain.replace(/^\./, '');
27
- // do not allow cross origin cookies
28
+ // do not allow cross origin cookies. There is no public suffix list here, so a
29
+ // multi-label suffix like 'co.uk' can not be told apart from a registrable domain
28
30
  if (
29
31
  // can't be valid if the requested domain is shorter than current hostname
30
32
  urlparts.hostname.length < domain.length ||
33
+ // a top level domain is not a valid scope, 'Domain=com' would otherwise be
34
+ // sent to every .com host. A trailing dot does not make 'com.' any better
35
+ domain.indexOf('.') < 0 ||
36
+ domain.endsWith('.') ||
37
+ // an IP address has no subdomains, so cookies set on it stay host-only
38
+ net.isIP(urlparts.hostname) ||
31
39
  // prefix domains with dot to be sure that partial matches are not used
32
- ('.' + urlparts.hostname).substr(-domain.length + 1) !== '.' + domain) {
40
+ !('.' + urlparts.hostname).endsWith('.' + domain)) {
33
41
  cookie.domain = urlparts.hostname;
34
42
  }
35
43
  }
@@ -149,9 +157,13 @@ export default class Cookies {
149
157
  ('.' + urlparts.hostname).substr(-cookie.domain.length) !== cookie.domain)) {
150
158
  return false;
151
159
  }
152
- // check if path matches
153
- const path = this.getPath(urlparts.pathname);
154
- if (path.substr(0, cookie.path.length) !== cookie.path) {
160
+ // check if the request path path-matches the cookie path (RFC 6265 section 5.1.4):
161
+ // identical paths match, otherwise the cookie path must be a directory prefix
162
+ const pathname = urlparts.pathname || '/';
163
+ const cookiePath = cookie.path;
164
+ const pathMatches = pathname === cookiePath ||
165
+ (pathname.startsWith(cookiePath) && (cookiePath.endsWith('/') || pathname.charAt(cookiePath.length) === '/'));
166
+ if (!pathMatches) {
155
167
  return false;
156
168
  }
157
169
  // check secure argument
@@ -208,22 +220,21 @@ export default class Cookies {
208
220
  return (cookie.expires && cookie.expires < new Date()) || !cookie.value;
209
221
  }
210
222
  /**
211
- * Returns normalized cookie path for an URL path argument
223
+ * Returns the default path for an URL path argument, the default-path of
224
+ * RFC 6265 section 5.1.4. A cookie that carries no Path attribute is scoped
225
+ * to the directory of the URL it was set from
212
226
  *
213
227
  * @param pathname
214
- * @returns Normalized path
228
+ * @returns Default path
215
229
  */
216
230
  getPath(pathname) {
217
231
  const pathParts = (pathname || '/').split('/');
218
232
  pathParts.pop(); // remove filename part
219
- let path = pathParts.join('/').trim();
220
- // ensure path prefix /
233
+ const path = pathParts.join('/').trim();
234
+ // a path that holds no more than one '/' is scoped to the root path, and so
235
+ // is one that does not start with '/' at all
221
236
  if (path.charAt(0) !== '/') {
222
- path = '/' + path;
223
- }
224
- // ensure path suffix /
225
- if (path.substr(-1) !== '/') {
226
- path += '/';
237
+ return '/';
227
238
  }
228
239
  return path;
229
240
  }
@@ -6,43 +6,43 @@ import Cookies from './cookies.js';
6
6
  */
7
7
  export interface FetchOptions {
8
8
  /** HTTP method, defaults to GET, or to POST when a body is given */
9
- method?: string;
9
+ method?: string | undefined;
10
10
  /** Request headers, keys are lowercased before use */
11
- headers?: http.OutgoingHttpHeaders;
11
+ headers?: http.OutgoingHttpHeaders | undefined;
12
12
  /** Overrides the default User-Agent header */
13
- userAgent?: string;
13
+ userAgent?: string | undefined;
14
14
  /** Cookie string(s) to seed the cookie jar with for this URL */
15
- cookie?: string | string[] | false;
15
+ cookie?: string | string[] | false | undefined;
16
16
  /** Cookie jar shared across redirects, created when missing */
17
- cookies?: Cookies;
17
+ cookies?: Cookies | undefined;
18
18
  /** Request body: a readable stream, a Buffer, a form object or a string */
19
19
  body?: Readable | Buffer | {
20
20
  [key: string]: any;
21
- } | string | false;
21
+ } | string | false | undefined;
22
22
  /** Content-Type header for the body, false leaves it out for a stream body */
23
- contentType?: string | false;
23
+ contentType?: string | false | undefined;
24
24
  /** TLS settings, only the keys listed in TLS_OPTION_KEYS are used */
25
25
  tls?: {
26
26
  [key: string]: any;
27
- };
27
+ } | undefined;
28
28
  /** Request timeout in milliseconds */
29
- timeout?: number;
29
+ timeout?: number | undefined;
30
30
  /** Maximum number of redirects to follow (default 5) */
31
- maxRedirects?: number;
31
+ maxRedirects?: number | undefined;
32
32
  /** Resolve responses with a status code of 300 or above instead of emitting an error */
33
- allowErrorResponse?: boolean;
33
+ allowErrorResponse?: boolean | undefined;
34
34
  /** Redirects followed so far, set by nmfetch itself */
35
- redirects?: number;
35
+ redirects?: number | undefined;
36
36
  /** Response stream shared across redirects, set by nmfetch itself */
37
- fetchRes?: FetchResponse;
37
+ fetchRes?: FetchResponse | undefined;
38
38
  }
39
39
  /**
40
40
  * The stream nmfetch returns. The response body is piped into it, the status code and
41
41
  * headers of the final response are attached once they arrive
42
42
  */
43
43
  export interface FetchResponse extends PassThrough {
44
- statusCode?: number;
45
- headers?: http.IncomingHttpHeaders;
44
+ statusCode?: number | undefined;
45
+ headers?: http.IncomingHttpHeaders | undefined;
46
46
  }
47
47
  declare function nmfetch(url: string, options?: FetchOptions): FetchResponse;
48
48
  declare namespace nmfetch {
@@ -7,9 +7,9 @@ import type { default as Mail, SentMessageInfo, SendMailOptions, TransportOption
7
7
  */
8
8
  export interface JSONTransportOptions extends TransportOptions {
9
9
  /** Selects this transport in createTransport */
10
- jsonTransport?: boolean;
10
+ jsonTransport?: boolean | undefined;
11
11
  /** If true, the message is returned as an object instead of a JSON string */
12
- skipEncoding?: boolean;
12
+ skipEncoding?: boolean | undefined;
13
13
  }
14
14
  /**
15
15
  * The value the JSON transport hands to the send callback
@@ -8,45 +8,45 @@ import type { OutgoingHttpHeaders } from 'node:http';
8
8
  */
9
9
  export interface MailComposerAlternative {
10
10
  /** The content itself: a string, a Buffer, a readable stream or a content descriptor */
11
- content?: MimeNodeContent;
11
+ content?: MimeNodeContent | undefined;
12
12
  /** File path, data URI or http(s) URL to read the content from */
13
- path?: string | false;
13
+ path?: string | false | undefined;
14
14
  /** URL or data URI to fetch the content from */
15
- href?: string | false;
15
+ href?: string | false | undefined;
16
16
  /** Request headers for a URL fetch */
17
- httpHeaders?: OutgoingHttpHeaders;
17
+ httpHeaders?: OutgoingHttpHeaders | undefined;
18
18
  /** TLS settings for a URL fetch, see nmfetch */
19
19
  tls?: {
20
20
  [key: string]: any;
21
- };
21
+ } | undefined;
22
22
  /** Encoding of a string `content`, decoded into a Buffer unless it is utf8 or ascii */
23
- encoding?: string;
23
+ encoding?: string | undefined;
24
24
  /** Pregenerated MIME part, used as is instead of building the node */
25
- raw?: MimeNodeContent;
25
+ raw?: MimeNodeContent | undefined;
26
26
  /** Content type, detected from the filename, path or URL when not set */
27
- contentType?: string;
27
+ contentType?: string | undefined;
28
28
  /** Content-Transfer-Encoding for the node, false leaves the choice to the node */
29
- contentTransferEncoding?: string | false;
29
+ contentTransferEncoding?: string | false | undefined;
30
30
  /** Filename for the node, false suppresses the generated one */
31
- filename?: string | false;
31
+ filename?: string | false | undefined;
32
32
  /** Additional headers for the node */
33
- headers?: MimeNodeHeaders;
33
+ headers?: MimeNodeHeaders | undefined;
34
34
  }
35
35
  /**
36
36
  * An attachment, the shape of the attachments entries
37
37
  */
38
38
  export interface MailComposerAttachment extends MailComposerAlternative {
39
39
  /** Content-Disposition for the node, 'attachment' by default and 'inline' for a message node or an image with a cid */
40
- contentDisposition?: string;
40
+ contentDisposition?: string | undefined;
41
41
  /** Content-Id for an embedded image, moves the attachment into the multipart/related node beside the html */
42
- cid?: string;
42
+ cid?: string | undefined;
43
43
  }
44
44
  /**
45
45
  * The icalEvent value as an object
46
46
  */
47
47
  export interface MailComposerIcalEvent extends MailComposerAlternative {
48
48
  /** iCalendar method, PUBLISH by default */
49
- method?: string;
49
+ method?: string | undefined;
50
50
  }
51
51
  /**
52
52
  * The attachments as sorted by getAttachments
@@ -62,7 +62,7 @@ export interface MailComposerAttachments {
62
62
  */
63
63
  export type MailComposerListHeaderEntry = string | {
64
64
  url: string;
65
- comment?: string;
65
+ comment?: string | undefined;
66
66
  };
67
67
  /**
68
68
  * The list value: List-* headers keyed by the part after "List-" (help, unsubscribe,
@@ -79,75 +79,68 @@ export interface MailComposerListHeaders {
79
79
  * by MailComposer itself, these are marked as such
80
80
  */
81
81
  export interface MailComposerOptions {
82
- from?: MimeNodeAddressInput;
83
- sender?: MimeNodeAddressInput;
84
- to?: MimeNodeAddressInput;
85
- cc?: MimeNodeAddressInput;
86
- bcc?: MimeNodeAddressInput;
87
- replyTo?: MimeNodeAddressInput;
88
- inReplyTo?: string;
89
- references?: string | string[];
90
- subject?: string;
82
+ from?: MimeNodeAddressInput | undefined;
83
+ sender?: MimeNodeAddressInput | undefined;
84
+ to?: MimeNodeAddressInput | undefined;
85
+ cc?: MimeNodeAddressInput | undefined;
86
+ bcc?: MimeNodeAddressInput | undefined;
87
+ replyTo?: MimeNodeAddressInput | undefined;
88
+ inReplyTo?: string | undefined;
89
+ references?: string | string[] | undefined;
90
+ subject?: string | undefined;
91
91
  /** Message-ID header value, generated when missing */
92
- messageId?: string;
92
+ messageId?: string | undefined;
93
93
  /** Date header value, the current time when missing */
94
- date?: Date | string;
94
+ date?: Date | string | undefined;
95
95
  /** Plaintext version of the message */
96
- text?: string | Buffer | Readable | MailComposerAlternative;
96
+ text?: string | Buffer | Readable | MailComposerAlternative | undefined;
97
97
  /** HTML version of the message */
98
- html?: string | Buffer | Readable | MailComposerAlternative;
98
+ html?: string | Buffer | Readable | MailComposerAlternative | undefined;
99
99
  /** Apple Watch specific HTML version of the message */
100
- watchHtml?: string | Buffer | Readable | MailComposerAlternative;
100
+ watchHtml?: string | Buffer | Readable | MailComposerAlternative | undefined;
101
101
  /** AMP4EMAIL version of the message */
102
- amp?: string | Buffer | Readable | MailComposerAlternative;
102
+ amp?: string | Buffer | Readable | MailComposerAlternative | undefined;
103
103
  /** iCalendar event, included both as a text/calendar alternative and as an application/ics attachment */
104
- icalEvent?: string | Buffer | Readable | MailComposerIcalEvent;
105
- attachments?: MailComposerAttachment[];
104
+ icalEvent?: string | Buffer | Readable | MailComposerIcalEvent | undefined;
105
+ attachments?: MailComposerAttachment[] | undefined;
106
106
  /** Further alternatives for the multipart/alternative node, after text, watchHtml, amp, html and the calendar event */
107
- alternatives?: MailComposerAlternative[];
107
+ alternatives?: MailComposerAlternative[] | undefined;
108
108
  /** Custom headers for the root node, the standard headers above override them */
109
- headers?: MimeNodeHeaders;
109
+ headers?: MimeNodeHeaders | undefined;
110
110
  /** List-* headers, read by the mailer */
111
- list?: MailComposerListHeaders;
111
+ list?: MailComposerListHeaders | undefined;
112
112
  /** SMTP envelope to use instead of the one generated from the headers */
113
- envelope?: MimeNodeEnvelopeInput;
113
+ envelope?: MimeNodeEnvelopeInput | undefined;
114
114
  /** Content-Transfer-Encoding to force for the text/* nodes that do not set their own */
115
- encoding?: string;
115
+ encoding?: string | undefined;
116
116
  /** Header string encoding, 'Q' (the default) or 'B', 'quoted-printable' and 'base64' are accepted as well */
117
- textEncoding?: string;
117
+ textEncoding?: string | undefined;
118
118
  /** Pregenerated rfc822 message, used as is instead of building one */
119
- raw?: MimeNodeContent;
119
+ raw?: MimeNodeContent | undefined;
120
120
  /** Reject content that points to a URL */
121
- disableUrlAccess?: boolean;
121
+ disableUrlAccess?: boolean | undefined;
122
122
  /** Reject content that points to a file path */
123
- disableFileAccess?: boolean;
123
+ disableFileAccess?: boolean | undefined;
124
124
  /** Convert data: images in the html into embedded attachments, read by the mailer */
125
- attachDataUrls?: boolean;
125
+ attachDataUrls?: boolean | undefined;
126
126
  /** Prefix for the generated multipart boundaries */
127
- boundaryPrefix?: string;
127
+ boundaryPrefix?: string | undefined;
128
128
  /** Shared part of the unique multipart boundary */
129
- baseBoundary?: string;
129
+ baseBoundary?: string | undefined;
130
130
  /** 'win' for CRLF and 'linux' for LF line breaks in the generated message, kept as is when not set */
131
- newline?: string;
131
+ newline?: string | undefined;
132
132
  /** Keep the Bcc header in the generated message, listed for completeness, the transports set it on the message directly */
133
- keepBcc?: boolean;
133
+ keepBcc?: boolean | undefined;
134
134
  /** Method to normalize header keys for custom caseing */
135
- normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'];
135
+ normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'] | undefined;
136
136
  /** 'high', 'normal' or 'low', sets the priority headers, read by the mailer */
137
- priority?: string;
137
+ priority?: string | undefined;
138
138
  /** X-Mailer header value, false leaves the header out, read by the mailer */
139
- xMailer?: string | false;
139
+ xMailer?: string | false | undefined;
140
140
  }
141
141
  declare class MailComposer {
142
142
  mail: MailComposerOptions;
143
143
  message: MimeNode | false;
144
- _alternatives: MailComposerAlternative[];
145
- _htmlNode: MailComposerAlternative | undefined;
146
- _attachments: MailComposerAttachments;
147
- _useRelated: boolean;
148
- _useAlternative: boolean;
149
- _useMixed: boolean | number;
150
- _icalEvent: MailComposerIcalEvent | undefined;
151
144
  constructor(mail?: MailComposerOptions);
152
145
  /**
153
146
  * Builds MimeNode instance
@@ -160,60 +153,12 @@ declare class MailComposer {
160
153
  * @returns An object of arrays (`related` and `attached`)
161
154
  */
162
155
  getAttachments(findRelated?: boolean): MailComposerAttachments;
163
- /**
164
- * Returns the icalEvent value with `path`/`href`/data uri input normalized into
165
- * a `content` entry, the same way as for regular attachments. The same event is
166
- * included twice (as a text/calendar alternative and as an application/ics
167
- * attachment), so the shared content object is marked to be resolved just once
168
- * and the buffered result is reused by the second node.
169
- *
170
- * @returns Normalized icalEvent data
171
- */
172
- _getIcalEvent(): MailComposerIcalEvent;
173
156
  /**
174
157
  * List alternatives. Resulting objects can be used as input for MimeNode nodes
175
158
  *
176
159
  * @returns An array of alternative elements. Includes the `text` and `html` values as well
177
160
  */
178
161
  getAlternatives(): MailComposerAlternative[];
179
- /**
180
- * Builds multipart/mixed node. It should always contain different type of elements on the same level
181
- * eg. text + attachments
182
- *
183
- * @param parentNode Parent for this note. If it does not exist, a root node is created
184
- * @returns MimeNode node element
185
- */
186
- _createMixed(parentNode?: MimeNode): MimeNode;
187
- /**
188
- * Builds multipart/alternative node. It should always contain same type of elements on the same level
189
- * eg. text + html view of the same data
190
- *
191
- * @param parentNode Parent for this note. If it does not exist, a root node is created
192
- * @returns MimeNode node element
193
- */
194
- _createAlternative(parentNode?: MimeNode): MimeNode;
195
- /**
196
- * Builds multipart/related node. It should always contain html node with related attachments
197
- *
198
- * @param parentNode Parent for this note. If it does not exist, a root node is created
199
- * @returns MimeNode node element
200
- */
201
- _createRelated(parentNode?: MimeNode): MimeNode;
202
- /**
203
- * Creates a regular node with contents
204
- *
205
- * @param parentNode Parent for this note. If it does not exist, a root node is created
206
- * @param element Node data
207
- * @returns MimeNode node element
208
- */
209
- _createContentNode(parentNode: MimeNode | false, element?: MailComposerAttachment): MimeNode;
210
- /**
211
- * Parses data uri and converts it to a Buffer
212
- *
213
- * @param element Content element
214
- * @return Parsed element
215
- */
216
- _processDataUrl<T extends MailComposerAlternative>(element: T): T;
217
162
  }
218
163
  /**
219
164
  * Type alias in the layout of the other modules (@types/nodemailer had no namespace for MailComposer)
@@ -113,8 +113,10 @@ class MailComposer {
113
113
  data.filename = attachment.filename;
114
114
  }
115
115
  else if (!isMessageNode && attachment.filename !== false) {
116
+ // a backslash separates as well, so a Windows path does not put the sender's directories in the headers
116
117
  data.filename =
117
- (attachment.path || attachment.href || '').split('/').pop().split('?').shift() || 'attachment-' + (i + 1);
118
+ (attachment.path || attachment.href || '').split(/[/\\]/).pop().split('?').shift() ||
119
+ 'attachment-' + (i + 1);
118
120
  if (data.filename.indexOf('.') < 0) {
119
121
  data.filename += '.' + mimeFuncs.detectExtension(data.contentType);
120
122
  }
@@ -181,6 +183,7 @@ class MailComposer {
181
183
  * and the buffered result is reused by the second node.
182
184
  *
183
185
  * @returns Normalized icalEvent data
186
+ * @internal
184
187
  */
185
188
  _getIcalEvent() {
186
189
  if (!this._icalEvent) {
@@ -214,7 +217,8 @@ class MailComposer {
214
217
  else if (icalEvent.href) {
215
218
  icalEvent.content = {
216
219
  href: icalEvent.href,
217
- httpHeaders: icalEvent.httpHeaders
220
+ httpHeaders: icalEvent.httpHeaders,
221
+ tls: icalEvent.tls
218
222
  };
219
223
  icalEvent.href = undefined;
220
224
  }
@@ -323,7 +327,9 @@ class MailComposer {
323
327
  }
324
328
  else if (alternative.href) {
325
329
  data.content = {
326
- href: alternative.href
330
+ href: alternative.href,
331
+ httpHeaders: alternative.httpHeaders,
332
+ tls: alternative.tls
327
333
  };
328
334
  }
329
335
  else {
@@ -345,6 +351,7 @@ class MailComposer {
345
351
  *
346
352
  * @param parentNode Parent for this note. If it does not exist, a root node is created
347
353
  * @returns MimeNode node element
354
+ * @internal
348
355
  */
349
356
  _createMixed(parentNode) {
350
357
  const node = parentNode
@@ -386,6 +393,7 @@ class MailComposer {
386
393
  *
387
394
  * @param parentNode Parent for this note. If it does not exist, a root node is created
388
395
  * @returns MimeNode node element
396
+ * @internal
389
397
  */
390
398
  _createAlternative(parentNode) {
391
399
  const node = parentNode
@@ -419,6 +427,7 @@ class MailComposer {
419
427
  *
420
428
  * @param parentNode Parent for this note. If it does not exist, a root node is created
421
429
  * @returns MimeNode node element
430
+ * @internal
422
431
  */
423
432
  _createRelated(parentNode) {
424
433
  const node = parentNode
@@ -447,6 +456,7 @@ class MailComposer {
447
456
  * @param parentNode Parent for this note. If it does not exist, a root node is created
448
457
  * @param element Node data
449
458
  * @returns MimeNode node element
459
+ * @internal
450
460
  */
451
461
  _createContentNode(parentNode, element) {
452
462
  element = element || {};
@@ -507,6 +517,7 @@ class MailComposer {
507
517
  *
508
518
  * @param element Content element
509
519
  * @return Parsed element
520
+ * @internal
510
521
  */
511
522
  _processDataUrl(element) {
512
523
  const dataUrl = element.path || element.href;
@@ -25,13 +25,13 @@ export interface SentMessageInfo {
25
25
  /** Message-ID of the sent message */
26
26
  messageId: string;
27
27
  /** Recipient addresses the transport accepted */
28
- accepted?: string[];
28
+ accepted?: string[] | undefined;
29
29
  /** Recipient addresses the transport rejected */
30
- rejected?: string[];
30
+ rejected?: string[] | undefined;
31
31
  /** Recipient addresses left pending, LMTP reports these */
32
- pending?: string[];
32
+ pending?: string[] | undefined;
33
33
  /** Last response from the server */
34
- response?: string;
34
+ response?: string | undefined;
35
35
  /** The generated message, for the transports that hand it back instead of sending it */
36
36
  message?: unknown;
37
37
  /** Transport specific fields */
@@ -59,8 +59,8 @@ export type PluginFunction<T = SentMessageInfo> = (mail: MailMessage<T>, callbac
59
59
  * the socket, with the host and port to connect to
60
60
  */
61
61
  export interface GetSocketOptions {
62
- host?: string;
63
- port?: number | string;
62
+ host?: string | undefined;
63
+ port?: number | string | undefined;
64
64
  [key: string]: any;
65
65
  }
66
66
  /**
@@ -68,7 +68,7 @@ export interface GetSocketOptions {
68
68
  */
69
69
  export interface SocketOptions {
70
70
  /** An established socket, the proxied connection */
71
- connection?: net.Socket;
71
+ connection?: net.Socket | undefined;
72
72
  }
73
73
  /**
74
74
  * Receives the socket options from a getSocket handler, or the error that prevented the
@@ -119,9 +119,9 @@ export interface Transport<T = SentMessageInfo> {
119
119
  /** Registers an event listener, the transport may emit 'log', 'error', 'idle' and 'clear' */
120
120
  on?(event: string | symbol, listener: (...args: any[]) => void): this;
121
121
  /** The Mail object the transport belongs to, set by Mail */
122
- mailer?: Mail<T>;
122
+ mailer?: Mail<T> | undefined;
123
123
  /** Socket handler for a proxied connection, set by Mail when a proxy is configured */
124
- getSocket?: GetSocketHandler;
124
+ getSocket?: GetSocketHandler | undefined;
125
125
  }
126
126
  /**
127
127
  * Transport configuration as read by Mail itself. The transport reads its own options from
@@ -129,25 +129,25 @@ export interface Transport<T = SentMessageInfo> {
129
129
  */
130
130
  export interface TransportOptions {
131
131
  /** Bunyan compatible logger, true for the default console logger, false or unset for no logging */
132
- logger?: shared.ExternalLogger | boolean;
132
+ logger?: shared.ExternalLogger | boolean | undefined;
133
133
  /** Component name for the log lines, defaults to 'mail' */
134
- component?: string;
134
+ component?: string | undefined;
135
135
  /** DKIM signing options, every message is signed with these unless it carries its own */
136
- dkim?: DKIMOptions;
136
+ dkim?: DKIMOptions | undefined;
137
137
  /** Proxy url. http(s) proxies work as is, socks proxies need the socks module set with set('proxy_socks_module', socks) */
138
- proxy?: string;
138
+ proxy?: string | undefined;
139
139
  /** TLS options, rejectUnauthorized applies to an https proxy as well */
140
- tls?: ConnectionOptions;
140
+ tls?: ConnectionOptions | undefined;
141
141
  /** Reject content that points to a file path, forced onto every message */
142
- disableFileAccess?: boolean;
142
+ disableFileAccess?: boolean | undefined;
143
143
  /** Reject content that points to a URL, forced onto every message */
144
- disableUrlAccess?: boolean;
144
+ disableUrlAccess?: boolean | undefined;
145
145
  /** Method to normalize header keys for custom caseing, forced onto every message */
146
- normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'];
146
+ normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'] | undefined;
147
147
  /** Recipients allowed on one message, forced onto every message, 0 disables the limit, defaults to 100000 */
148
- maxRecipients?: number;
148
+ maxRecipients?: number | undefined;
149
149
  /** Convert data: images in the html into embedded attachments */
150
- attachDataUrls?: boolean;
150
+ attachDataUrls?: boolean | undefined;
151
151
  }
152
152
  /**
153
153
  * The transporter object createTransport returns, a Mail instance wrapping a transport
@@ -161,13 +161,8 @@ export type Transporter<T = SentMessageInfo> = Mail<T>;
161
161
  */
162
162
  declare class Mail<out T = SentMessageInfo> extends EventEmitter {
163
163
  options: TransportOptions;
164
+ /** Message defaults given to createTransport, kept public because the DefinitelyTyped typings declared it */
164
165
  _defaults: MailDefaults;
165
- _defaultPlugins: {
166
- [step: string]: PluginFunction<any>[];
167
- };
168
- _userPlugins: {
169
- [step: string]: PluginFunction<any>[];
170
- };
171
166
  meta: Map<string, any>;
172
167
  dkim: DKIM | false;
173
168
  transporter: Transport<T>;
@@ -182,7 +177,7 @@ declare class Mail<out T = SentMessageInfo> extends EventEmitter {
182
177
  (): Promise<true>;
183
178
  };
184
179
  /** Socket handler for a proxied connection, set by setupProxy and handed to the transport on the next send */
185
- getSocket?: GetSocketHandler | false;
180
+ getSocket?: GetSocketHandler | false | undefined;
186
181
  constructor(transporter: Transport<T>, options?: TransportOptions, defaults?: MailDefaults);
187
182
  use(step: string, plugin: PluginFunction<T>): this;
188
183
  /**
@@ -194,14 +189,12 @@ declare class Mail<out T = SentMessageInfo> extends EventEmitter {
194
189
  sendMail(data: SendMailOptions): Promise<T>;
195
190
  sendMail(data: SendMailOptions, callback: SendMailCallback<T>): void;
196
191
  getVersionString(): string;
197
- _processPlugins(step: string, mail: MailMessage<T>, callback: PluginCallback): void;
198
192
  /**
199
193
  * Sets up proxy handler for a Nodemailer object
200
194
  *
201
195
  * @param proxyUrl Proxy configuration url
202
196
  */
203
197
  setupProxy(proxyUrl: string): void;
204
- _convertDataImages(mail: MailMessage<T>, callback: PluginCallback): void;
205
198
  set<K extends keyof MailMeta & string>(key: K, value: MailMeta[K]): Map<string, any>;
206
199
  get<K extends keyof MailMeta & string>(key: K): MailMeta[K] | undefined;
207
200
  }