@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.
- package/.jsii +3 -3
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/checksums/package.json +2 -2
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +3 -3
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +3 -3
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +38 -15
- package/node_modules/@aws-sdk/client-s3/dist-es/models/enums.js +7 -0
- package/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js +28 -14
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/CopyObjectCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/CreateMultipartUploadCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetBucketInventoryConfigurationCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetBucketNotificationConfigurationCommand.d.ts +3 -3
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetObjectCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetObjectLockConfigurationCommand.d.ts +4 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetObjectRetentionCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/HeadObjectCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/ListBucketInventoryConfigurationsCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutBucketInventoryConfigurationCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutBucketNotificationConfigurationCommand.d.ts +3 -3
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutObjectCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutObjectLockConfigurationCommand.d.ts +4 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutObjectRetentionCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutPublicAccessBlockCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/models/enums.d.ts +15 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/models/models_0.d.ts +186 -49
- package/node_modules/@aws-sdk/client-s3/dist-types/models/models_1.d.ts +43 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/schemas/schemas_0.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/commands/PutPublicAccessBlockCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/enums.d.ts +8 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/models_0.d.ts +23 -7
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/models_1.d.ts +14 -1
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/schemas/schemas_0.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/package.json +6 -6
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ses/package.json +3 -3
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ssm/package.json +3 -3
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +5 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js +3 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/index.js +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/hasOwn.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/hasOwn.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@zone-eu/mailsplit/package.json +3 -3
- package/node_modules/encoding-japanese/LICENSE +25 -1
- package/node_modules/encoding-japanese/README.md +86 -51
- package/node_modules/encoding-japanese/encoding.js +107 -78
- package/node_modules/encoding-japanese/encoding.min.js +2 -2
- package/node_modules/encoding-japanese/index.d.ts +102 -0
- package/node_modules/encoding-japanese/package.json +26 -17
- package/node_modules/encoding-japanese/src/encoding-convert.js +67 -58
- package/node_modules/encoding-japanese/src/encoding-table.js +1 -0
- package/node_modules/encoding-japanese/src/index.js +1 -1
- package/node_modules/encoding-japanese/src/kana-case-table.js +1 -1
- package/node_modules/encoding-japanese/src/utf8-to-jis-alias-table.js +14 -0
- package/node_modules/encoding-japanese/src/utf8-to-jis-table.js +6 -5
- package/node_modules/encoding-japanese/src/utf8-to-jisx0212-table.js +7 -5
- package/node_modules/libmime/CHANGELOG.md +7 -0
- package/node_modules/libmime/package.json +2 -2
- package/node_modules/mailparser/.release-please-manifest.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +42 -0
- package/node_modules/mailparser/package.json +5 -5
- package/node_modules/nodemailer/CHANGELOG.md +83 -0
- package/node_modules/nodemailer/dist/cjs/addressparser/index.d.ts +1 -3
- package/node_modules/nodemailer/dist/cjs/addressparser/index.js +176 -13
- package/node_modules/nodemailer/dist/cjs/base64/index.d.ts +2 -6
- package/node_modules/nodemailer/dist/cjs/base64/index.js +2 -0
- package/node_modules/nodemailer/dist/cjs/dkim/index.d.ts +4 -4
- package/node_modules/nodemailer/dist/cjs/dkim/message-parser.d.ts +1 -3
- package/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +14 -5
- package/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.d.ts +3 -22
- package/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.js +5 -0
- package/node_modules/nodemailer/dist/cjs/dkim/sign.d.ts +5 -5
- package/node_modules/nodemailer/dist/cjs/errors.d.ts +8 -8
- package/node_modules/nodemailer/dist/cjs/fetch/cookies.d.ts +12 -10
- package/node_modules/nodemailer/dist/cjs/fetch/cookies.js +28 -14
- package/node_modules/nodemailer/dist/cjs/fetch/index.d.ts +15 -15
- package/node_modules/nodemailer/dist/cjs/json-transport/index.d.ts +2 -2
- package/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +49 -104
- package/node_modules/nodemailer/dist/cjs/mail-composer/index.js +14 -3
- package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +21 -28
- package/node_modules/nodemailer/dist/cjs/mailer/index.js +19 -5
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +8 -12
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.js +4 -1
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +4 -1
- package/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +37 -191
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +82 -12
- package/node_modules/nodemailer/dist/cjs/mime-node/last-newline.d.ts +1 -3
- package/node_modules/nodemailer/dist/cjs/mime-node/last-newline.js +2 -0
- package/node_modules/nodemailer/dist/cjs/mime-node/le-unix.d.ts +1 -5
- package/node_modules/nodemailer/dist/cjs/mime-node/le-unix.js +1 -0
- package/node_modules/nodemailer/dist/cjs/mime-node/le-windows.d.ts +1 -5
- package/node_modules/nodemailer/dist/cjs/mime-node/le-windows.js +1 -0
- package/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +2 -2
- package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
- package/node_modules/nodemailer/dist/cjs/qp/index.d.ts +2 -5
- package/node_modules/nodemailer/dist/cjs/qp/index.js +2 -0
- package/node_modules/nodemailer/dist/cjs/sendmail-transport/index.d.ts +4 -6
- package/node_modules/nodemailer/dist/cjs/ses-transport/index.d.ts +2 -2
- package/node_modules/nodemailer/dist/cjs/ses-transport/index.js +5 -1
- package/node_modules/nodemailer/dist/cjs/shared/index.d.ts +31 -37
- package/node_modules/nodemailer/dist/cjs/shared/index.js +19 -7
- package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.d.ts +1 -9
- package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.js +2 -0
- package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +65 -403
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +99 -19
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +8 -46
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +13 -2
- package/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.d.ts +2 -4
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +16 -16
- package/node_modules/nodemailer/dist/cjs/stream-transport/index.d.ts +3 -3
- package/node_modules/nodemailer/dist/cjs/well-known/index.d.ts +9 -9
- package/node_modules/nodemailer/dist/cjs/well-known/services.js +2 -0
- package/node_modules/nodemailer/dist/cjs/xoauth2/index.d.ts +18 -18
- package/node_modules/nodemailer/dist/esm/addressparser/index.d.ts +1 -3
- package/node_modules/nodemailer/dist/esm/addressparser/index.js +176 -13
- package/node_modules/nodemailer/dist/esm/base64/index.d.ts +2 -6
- package/node_modules/nodemailer/dist/esm/base64/index.js +2 -0
- package/node_modules/nodemailer/dist/esm/dkim/index.d.ts +4 -4
- package/node_modules/nodemailer/dist/esm/dkim/message-parser.d.ts +1 -3
- package/node_modules/nodemailer/dist/esm/dkim/message-parser.js +14 -5
- package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.d.ts +3 -22
- package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js +5 -0
- package/node_modules/nodemailer/dist/esm/dkim/sign.d.ts +5 -5
- package/node_modules/nodemailer/dist/esm/errors.d.ts +8 -8
- package/node_modules/nodemailer/dist/esm/fetch/cookies.d.ts +12 -10
- package/node_modules/nodemailer/dist/esm/fetch/cookies.js +25 -14
- package/node_modules/nodemailer/dist/esm/fetch/index.d.ts +15 -15
- package/node_modules/nodemailer/dist/esm/json-transport/index.d.ts +2 -2
- package/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +49 -104
- package/node_modules/nodemailer/dist/esm/mail-composer/index.js +14 -3
- package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +21 -28
- package/node_modules/nodemailer/dist/esm/mailer/index.js +19 -5
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +8 -12
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.js +4 -1
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +4 -1
- package/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +37 -191
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +82 -12
- package/node_modules/nodemailer/dist/esm/mime-node/last-newline.d.ts +1 -3
- package/node_modules/nodemailer/dist/esm/mime-node/last-newline.js +2 -0
- package/node_modules/nodemailer/dist/esm/mime-node/le-unix.d.ts +1 -5
- package/node_modules/nodemailer/dist/esm/mime-node/le-unix.js +1 -0
- package/node_modules/nodemailer/dist/esm/mime-node/le-windows.d.ts +1 -5
- package/node_modules/nodemailer/dist/esm/mime-node/le-windows.js +1 -0
- package/node_modules/nodemailer/dist/esm/nodemailer.d.ts +2 -2
- package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
- package/node_modules/nodemailer/dist/esm/qp/index.d.ts +2 -5
- package/node_modules/nodemailer/dist/esm/qp/index.js +2 -0
- package/node_modules/nodemailer/dist/esm/sendmail-transport/index.d.ts +4 -6
- package/node_modules/nodemailer/dist/esm/ses-transport/index.d.ts +2 -2
- package/node_modules/nodemailer/dist/esm/ses-transport/index.js +5 -1
- package/node_modules/nodemailer/dist/esm/shared/index.d.ts +31 -37
- package/node_modules/nodemailer/dist/esm/shared/index.js +19 -7
- package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.d.ts +1 -9
- package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js +2 -0
- package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +65 -403
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +99 -19
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +8 -46
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.js +13 -2
- package/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.d.ts +2 -4
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +16 -16
- package/node_modules/nodemailer/dist/esm/stream-transport/index.d.ts +3 -3
- package/node_modules/nodemailer/dist/esm/well-known/index.d.ts +9 -9
- package/node_modules/nodemailer/dist/esm/well-known/services.js +2 -0
- package/node_modules/nodemailer/dist/esm/xoauth2/index.d.ts +18 -18
- package/node_modules/nodemailer/dist/well-known/services.json +2 -2
- package/node_modules/nodemailer/package.json +6 -6
- package/package.json +1 -1
|
@@ -33,7 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const node_net_1 = __importDefault(require("node:net"));
|
|
37
41
|
const urllib = __importStar(require("../shared/url.js"));
|
|
38
42
|
const SESSION_TIMEOUT = 1800; // 30 min
|
|
39
43
|
/**
|
|
@@ -59,12 +63,19 @@ class Cookies {
|
|
|
59
63
|
let domain;
|
|
60
64
|
if (cookie.domain) {
|
|
61
65
|
domain = cookie.domain.replace(/^\./, '');
|
|
62
|
-
// do not allow cross origin cookies
|
|
66
|
+
// do not allow cross origin cookies. There is no public suffix list here, so a
|
|
67
|
+
// multi-label suffix like 'co.uk' can not be told apart from a registrable domain
|
|
63
68
|
if (
|
|
64
69
|
// can't be valid if the requested domain is shorter than current hostname
|
|
65
70
|
urlparts.hostname.length < domain.length ||
|
|
71
|
+
// a top level domain is not a valid scope, 'Domain=com' would otherwise be
|
|
72
|
+
// sent to every .com host. A trailing dot does not make 'com.' any better
|
|
73
|
+
domain.indexOf('.') < 0 ||
|
|
74
|
+
domain.endsWith('.') ||
|
|
75
|
+
// an IP address has no subdomains, so cookies set on it stay host-only
|
|
76
|
+
node_net_1.default.isIP(urlparts.hostname) ||
|
|
66
77
|
// prefix domains with dot to be sure that partial matches are not used
|
|
67
|
-
('.' + urlparts.hostname).
|
|
78
|
+
!('.' + urlparts.hostname).endsWith('.' + domain)) {
|
|
68
79
|
cookie.domain = urlparts.hostname;
|
|
69
80
|
}
|
|
70
81
|
}
|
|
@@ -184,9 +195,13 @@ class Cookies {
|
|
|
184
195
|
('.' + urlparts.hostname).substr(-cookie.domain.length) !== cookie.domain)) {
|
|
185
196
|
return false;
|
|
186
197
|
}
|
|
187
|
-
// check if path matches
|
|
188
|
-
|
|
189
|
-
|
|
198
|
+
// check if the request path path-matches the cookie path (RFC 6265 section 5.1.4):
|
|
199
|
+
// identical paths match, otherwise the cookie path must be a directory prefix
|
|
200
|
+
const pathname = urlparts.pathname || '/';
|
|
201
|
+
const cookiePath = cookie.path;
|
|
202
|
+
const pathMatches = pathname === cookiePath ||
|
|
203
|
+
(pathname.startsWith(cookiePath) && (cookiePath.endsWith('/') || pathname.charAt(cookiePath.length) === '/'));
|
|
204
|
+
if (!pathMatches) {
|
|
190
205
|
return false;
|
|
191
206
|
}
|
|
192
207
|
// check secure argument
|
|
@@ -243,22 +258,21 @@ class Cookies {
|
|
|
243
258
|
return (cookie.expires && cookie.expires < new Date()) || !cookie.value;
|
|
244
259
|
}
|
|
245
260
|
/**
|
|
246
|
-
* Returns
|
|
261
|
+
* Returns the default path for an URL path argument, the default-path of
|
|
262
|
+
* RFC 6265 section 5.1.4. A cookie that carries no Path attribute is scoped
|
|
263
|
+
* to the directory of the URL it was set from
|
|
247
264
|
*
|
|
248
265
|
* @param pathname
|
|
249
|
-
* @returns
|
|
266
|
+
* @returns Default path
|
|
250
267
|
*/
|
|
251
268
|
getPath(pathname) {
|
|
252
269
|
const pathParts = (pathname || '/').split('/');
|
|
253
270
|
pathParts.pop(); // remove filename part
|
|
254
|
-
|
|
255
|
-
//
|
|
271
|
+
const path = pathParts.join('/').trim();
|
|
272
|
+
// a path that holds no more than one '/' is scoped to the root path, and so
|
|
273
|
+
// is one that does not start with '/' at all
|
|
256
274
|
if (path.charAt(0) !== '/') {
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
// ensure path suffix /
|
|
260
|
-
if (path.substr(-1) !== '/') {
|
|
261
|
-
path += '/';
|
|
275
|
+
return '/';
|
|
262
276
|
}
|
|
263
277
|
return path;
|
|
264
278
|
}
|
|
@@ -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)
|
|
@@ -151,8 +151,10 @@ class MailComposer {
|
|
|
151
151
|
data.filename = attachment.filename;
|
|
152
152
|
}
|
|
153
153
|
else if (!isMessageNode && attachment.filename !== false) {
|
|
154
|
+
// a backslash separates as well, so a Windows path does not put the sender's directories in the headers
|
|
154
155
|
data.filename =
|
|
155
|
-
(attachment.path || attachment.href || '').split(
|
|
156
|
+
(attachment.path || attachment.href || '').split(/[/\\]/).pop().split('?').shift() ||
|
|
157
|
+
'attachment-' + (i + 1);
|
|
156
158
|
if (data.filename.indexOf('.') < 0) {
|
|
157
159
|
data.filename += '.' + mimeFuncs.detectExtension(data.contentType);
|
|
158
160
|
}
|
|
@@ -219,6 +221,7 @@ class MailComposer {
|
|
|
219
221
|
* and the buffered result is reused by the second node.
|
|
220
222
|
*
|
|
221
223
|
* @returns Normalized icalEvent data
|
|
224
|
+
* @internal
|
|
222
225
|
*/
|
|
223
226
|
_getIcalEvent() {
|
|
224
227
|
if (!this._icalEvent) {
|
|
@@ -252,7 +255,8 @@ class MailComposer {
|
|
|
252
255
|
else if (icalEvent.href) {
|
|
253
256
|
icalEvent.content = {
|
|
254
257
|
href: icalEvent.href,
|
|
255
|
-
httpHeaders: icalEvent.httpHeaders
|
|
258
|
+
httpHeaders: icalEvent.httpHeaders,
|
|
259
|
+
tls: icalEvent.tls
|
|
256
260
|
};
|
|
257
261
|
icalEvent.href = undefined;
|
|
258
262
|
}
|
|
@@ -361,7 +365,9 @@ class MailComposer {
|
|
|
361
365
|
}
|
|
362
366
|
else if (alternative.href) {
|
|
363
367
|
data.content = {
|
|
364
|
-
href: alternative.href
|
|
368
|
+
href: alternative.href,
|
|
369
|
+
httpHeaders: alternative.httpHeaders,
|
|
370
|
+
tls: alternative.tls
|
|
365
371
|
};
|
|
366
372
|
}
|
|
367
373
|
else {
|
|
@@ -383,6 +389,7 @@ class MailComposer {
|
|
|
383
389
|
*
|
|
384
390
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
385
391
|
* @returns MimeNode node element
|
|
392
|
+
* @internal
|
|
386
393
|
*/
|
|
387
394
|
_createMixed(parentNode) {
|
|
388
395
|
const node = parentNode
|
|
@@ -424,6 +431,7 @@ class MailComposer {
|
|
|
424
431
|
*
|
|
425
432
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
426
433
|
* @returns MimeNode node element
|
|
434
|
+
* @internal
|
|
427
435
|
*/
|
|
428
436
|
_createAlternative(parentNode) {
|
|
429
437
|
const node = parentNode
|
|
@@ -457,6 +465,7 @@ class MailComposer {
|
|
|
457
465
|
*
|
|
458
466
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
459
467
|
* @returns MimeNode node element
|
|
468
|
+
* @internal
|
|
460
469
|
*/
|
|
461
470
|
_createRelated(parentNode) {
|
|
462
471
|
const node = parentNode
|
|
@@ -485,6 +494,7 @@ class MailComposer {
|
|
|
485
494
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
486
495
|
* @param element Node data
|
|
487
496
|
* @returns MimeNode node element
|
|
497
|
+
* @internal
|
|
488
498
|
*/
|
|
489
499
|
_createContentNode(parentNode, element) {
|
|
490
500
|
element = element || {};
|
|
@@ -545,6 +555,7 @@ class MailComposer {
|
|
|
545
555
|
*
|
|
546
556
|
* @param element Content element
|
|
547
557
|
* @return Parsed element
|
|
558
|
+
* @internal
|
|
548
559
|
*/
|
|
549
560
|
_processDataUrl(element) {
|
|
550
561
|
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
|
}
|
|
@@ -172,12 +172,24 @@ class Mail extends node_events_1.EventEmitter {
|
|
|
172
172
|
}, 'PluginCompile Error: %s', err.message);
|
|
173
173
|
return done(err);
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
let recipientCount;
|
|
176
|
+
try {
|
|
177
|
+
mail.message = new index_js_1.default(mail.data).compile();
|
|
178
|
+
mail.setMailerHeader();
|
|
179
|
+
mail.setPriorityHeaders();
|
|
180
|
+
mail.setListHeaders();
|
|
181
|
+
recipientCount = mail.message.getEnvelope().to.length;
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
// message data can throw while it is compiled, the error belongs to the callback
|
|
185
|
+
this.logger.error({
|
|
186
|
+
err,
|
|
187
|
+
tnx: 'transport',
|
|
188
|
+
action: 'send'
|
|
189
|
+
}, 'Compile Error: %s', err.message);
|
|
190
|
+
return done(err);
|
|
191
|
+
}
|
|
179
192
|
const maxRecipients = mail.data.maxRecipients === undefined ? DEFAULT_MAX_RECIPIENTS : mail.data.maxRecipients;
|
|
180
|
-
const recipientCount = mail.message.getEnvelope().to.length;
|
|
181
193
|
if (maxRecipients && recipientCount > maxRecipients) {
|
|
182
194
|
const err = new Error(`Message has ${recipientCount} recipients, which is over the ${maxRecipients} allowed by maxRecipients`);
|
|
183
195
|
err.code = errors.EMAXRECIPIENTS;
|
|
@@ -225,6 +237,7 @@ class Mail extends node_events_1.EventEmitter {
|
|
|
225
237
|
getVersionString() {
|
|
226
238
|
return node_util_1.default.format('%s (%s; +%s; %s/%s)', packageData.name, packageData.version, packageData.homepage, this.transporter.name, this.transporter.version);
|
|
227
239
|
}
|
|
240
|
+
/** @internal */
|
|
228
241
|
_processPlugins(step, mail, callback) {
|
|
229
242
|
step = (step || '').toString();
|
|
230
243
|
if (!this._userPlugins.hasOwnProperty(step)) {
|
|
@@ -359,6 +372,7 @@ class Mail extends node_events_1.EventEmitter {
|
|
|
359
372
|
callback(err);
|
|
360
373
|
};
|
|
361
374
|
}
|
|
375
|
+
/** @internal */
|
|
362
376
|
_convertDataImages(mail, callback) {
|
|
363
377
|
if ((!this.options.attachDataUrls && !mail.data.attachDataUrls) || !mail.data.html) {
|
|
364
378
|
return callback();
|