@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
|
@@ -134,12 +134,24 @@ class Mail extends EventEmitter {
|
|
|
134
134
|
}, 'PluginCompile Error: %s', err.message);
|
|
135
135
|
return done(err);
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
let recipientCount;
|
|
138
|
+
try {
|
|
139
|
+
mail.message = new MailComposer(mail.data).compile();
|
|
140
|
+
mail.setMailerHeader();
|
|
141
|
+
mail.setPriorityHeaders();
|
|
142
|
+
mail.setListHeaders();
|
|
143
|
+
recipientCount = mail.message.getEnvelope().to.length;
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
// message data can throw while it is compiled, the error belongs to the callback
|
|
147
|
+
this.logger.error({
|
|
148
|
+
err,
|
|
149
|
+
tnx: 'transport',
|
|
150
|
+
action: 'send'
|
|
151
|
+
}, 'Compile Error: %s', err.message);
|
|
152
|
+
return done(err);
|
|
153
|
+
}
|
|
141
154
|
const maxRecipients = mail.data.maxRecipients === undefined ? DEFAULT_MAX_RECIPIENTS : mail.data.maxRecipients;
|
|
142
|
-
const recipientCount = mail.message.getEnvelope().to.length;
|
|
143
155
|
if (maxRecipients && recipientCount > maxRecipients) {
|
|
144
156
|
const err = new Error(`Message has ${recipientCount} recipients, which is over the ${maxRecipients} allowed by maxRecipients`);
|
|
145
157
|
err.code = errors.EMAXRECIPIENTS;
|
|
@@ -187,6 +199,7 @@ class Mail extends EventEmitter {
|
|
|
187
199
|
getVersionString() {
|
|
188
200
|
return util.format('%s (%s; +%s; %s/%s)', packageData.name, packageData.version, packageData.homepage, this.transporter.name, this.transporter.version);
|
|
189
201
|
}
|
|
202
|
+
/** @internal */
|
|
190
203
|
_processPlugins(step, mail, callback) {
|
|
191
204
|
step = (step || '').toString();
|
|
192
205
|
if (!this._userPlugins.hasOwnProperty(step)) {
|
|
@@ -321,6 +334,7 @@ class Mail extends EventEmitter {
|
|
|
321
334
|
callback(err);
|
|
322
335
|
};
|
|
323
336
|
}
|
|
337
|
+
/** @internal */
|
|
324
338
|
_convertDataImages(mail, callback) {
|
|
325
339
|
if ((!this.options.attachDataUrls && !mail.data.attachDataUrls) || !mail.data.html) {
|
|
326
340
|
return callback();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MimeNode, { type MimeNodePreparedHeaderValue } from '../mime-node/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MailComposerOptions } from '../mail-composer/index.js';
|
|
3
3
|
import type { DKIMOptions } from '../dkim/index.js';
|
|
4
4
|
import type { SMTPEnvelopeDsn } from '../smtp-connection/index.js';
|
|
5
5
|
import type { SMTPTransportAuthOptions } from '../smtp-transport/index.js';
|
|
@@ -13,21 +13,19 @@ import type { SentMessageInfo } from './index.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface SendMailOptions extends MailComposerOptions {
|
|
15
15
|
/** DKIM signing options for this message, used instead of the ones of the transporter */
|
|
16
|
-
dkim?: DKIMOptions;
|
|
17
|
-
/** Extra DKIM options for this message, merged over the options of the signer */
|
|
18
|
-
_dkim?: DKIMOptions;
|
|
16
|
+
dkim?: DKIMOptions | undefined;
|
|
19
17
|
/** Recipients allowed on this message, 0 disables the limit, defaults to 100000 */
|
|
20
|
-
maxRecipients?: number;
|
|
18
|
+
maxRecipients?: number | undefined;
|
|
21
19
|
/** SMTP transports: DSN parameters for the envelope, sent when the server supports the DSN extension */
|
|
22
|
-
dsn?: SMTPEnvelopeDsn;
|
|
20
|
+
dsn?: SMTPEnvelopeDsn | undefined;
|
|
23
21
|
/** SMTP transports: RFC 8689, send the REQUIRETLS parameter with MAIL FROM */
|
|
24
|
-
requireTLSExtensionEnabled?: boolean;
|
|
22
|
+
requireTLSExtensionEnabled?: boolean | undefined;
|
|
25
23
|
/** SMTP transports: per-message authentication settings, used instead of the transport level auth */
|
|
26
|
-
auth?: SMTPTransportAuthOptions;
|
|
24
|
+
auth?: SMTPTransportAuthOptions | undefined;
|
|
27
25
|
/** SES transport: extra SendEmailCommand parameters merged into the API call */
|
|
28
26
|
ses?: {
|
|
29
27
|
[key: string]: unknown;
|
|
30
|
-
};
|
|
28
|
+
} | undefined;
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* Default message fields, the third argument of createTransport. Applied to every message
|
|
@@ -43,7 +41,7 @@ export interface MailMessageData extends SendMailOptions {
|
|
|
43
41
|
/** Header values flattened to strings and keyed by lowercase header name, set by normalize */
|
|
44
42
|
normalizedHeaders?: {
|
|
45
43
|
[key: string]: string;
|
|
46
|
-
};
|
|
44
|
+
} | undefined;
|
|
47
45
|
}
|
|
48
46
|
/**
|
|
49
47
|
* Callback for resolveAll and normalize, receives the message data with every content value
|
|
@@ -89,6 +87,4 @@ export default class MailMessage<T = SentMessageInfo> {
|
|
|
89
87
|
setMailerHeader(): void;
|
|
90
88
|
setPriorityHeaders(): void;
|
|
91
89
|
setListHeaders(): void;
|
|
92
|
-
_getListHeaders(listData: MailComposerListHeaders): MailMessageListHeader[];
|
|
93
|
-
_formatListUrl(url: string): string;
|
|
94
90
|
}
|
|
@@ -69,8 +69,9 @@ export default class MailMessage {
|
|
|
69
69
|
if (this.data.attachments && this.data.attachments.length) {
|
|
70
70
|
this.data.attachments.forEach((attachment, i) => {
|
|
71
71
|
if (!attachment.filename) {
|
|
72
|
+
// a backslash separates as well, so a Windows path does not put the sender's directories in the headers
|
|
72
73
|
attachment.filename =
|
|
73
|
-
(attachment.path || attachment.href || '').split(
|
|
74
|
+
(attachment.path || attachment.href || '').split(/[/\\]/).pop().split('?').shift() ||
|
|
74
75
|
'attachment-' + (i + 1);
|
|
75
76
|
if (attachment.filename.indexOf('.') < 0) {
|
|
76
77
|
attachment.filename += '.' + mimeFuncs.detectExtension(attachment.contentType);
|
|
@@ -239,6 +240,7 @@ export default class MailMessage {
|
|
|
239
240
|
});
|
|
240
241
|
});
|
|
241
242
|
}
|
|
243
|
+
/** @internal */
|
|
242
244
|
_getListHeaders(listData) {
|
|
243
245
|
// make sure an url looks like <protocol:url>
|
|
244
246
|
return Object.keys(listData).map(key => ({
|
|
@@ -283,6 +285,7 @@ export default class MailMessage {
|
|
|
283
285
|
}))
|
|
284
286
|
}));
|
|
285
287
|
}
|
|
288
|
+
/** @internal */
|
|
286
289
|
_formatListUrl(url) {
|
|
287
290
|
// a url has no way to carry a control char or DEL, and the angle brackets around it
|
|
288
291
|
// are not a quoting construct, so anything left here lands in the header raw
|
|
@@ -14,7 +14,7 @@ export interface StructuredHeaderValue {
|
|
|
14
14
|
/** The value ahead of the parameters, for example the content type */
|
|
15
15
|
value: string | false;
|
|
16
16
|
/** Parameter values keyed by parameter name */
|
|
17
|
-
params?: Record<string, string
|
|
17
|
+
params?: Record<string, string> | undefined;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* A single key=value pair of an rfc2231 encoded header parameter
|
|
@@ -76,7 +76,10 @@ export function encodeWord(data, mimeWordEncoding, maxLength) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
else if (mimeWordEncoding === 'B') {
|
|
79
|
-
|
|
79
|
+
// the chunking loop below splits raw text and base64 encodes each part, so a
|
|
80
|
+
// Buffer goes in as its UTF-8 string: handing it the base64 of the whole input
|
|
81
|
+
// would encode the encoding itself and decode back to base64 text
|
|
82
|
+
encodedStr = typeof data === 'string' ? data : data.toString('utf-8');
|
|
80
83
|
maxLength = maxLength ? Math.max(3, ((maxLength - (maxLength % 4)) / 4) * 3) : 0;
|
|
81
84
|
}
|
|
82
85
|
if (maxLength && (mimeWordEncoding !== 'B' ? encodedStr : base64.encode(data)).length > maxLength) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type Duplex, type Readable, type TransformOptions, type Writable } from 'node:stream';
|
|
2
|
-
import * as mimeFuncs from '../mime-funcs/index.js';
|
|
3
|
-
import { type Address } from '../addressparser/index.js';
|
|
4
2
|
import type { NodemailerError } from '../errors.js';
|
|
5
3
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
6
4
|
/**
|
|
@@ -8,38 +6,38 @@ import type { OutgoingHttpHeaders } from 'node:http';
|
|
|
8
6
|
*/
|
|
9
7
|
export interface MimeNodeOptions {
|
|
10
8
|
/** root node for this tree */
|
|
11
|
-
rootNode?: MimeNode;
|
|
9
|
+
rootNode?: MimeNode | undefined;
|
|
12
10
|
/** immediate parent for this node */
|
|
13
|
-
parentNode?: MimeNode;
|
|
11
|
+
parentNode?: MimeNode | undefined;
|
|
14
12
|
/** filename for an attachment node */
|
|
15
|
-
filename?: string;
|
|
13
|
+
filename?: string | undefined;
|
|
16
14
|
/** shared part of the unique multipart boundary */
|
|
17
|
-
baseBoundary?: string;
|
|
15
|
+
baseBoundary?: string | undefined;
|
|
18
16
|
/** prefix for the generated multipart boundaries, defaults to '--_NmP' */
|
|
19
|
-
boundaryPrefix?: string;
|
|
17
|
+
boundaryPrefix?: string | undefined;
|
|
20
18
|
/** If true, do not exclude Bcc from the generated headers */
|
|
21
|
-
keepBcc?: boolean;
|
|
19
|
+
keepBcc?: boolean | undefined;
|
|
22
20
|
/** method to normalize header keys for custom caseing */
|
|
23
|
-
normalizeHeaderKey?: (key: string, value: string) => string;
|
|
21
|
+
normalizeHeaderKey?: ((key: string, value: string) => string) | undefined;
|
|
24
22
|
/** either 'Q' (the default) or 'B' */
|
|
25
|
-
textEncoding?: string;
|
|
23
|
+
textEncoding?: string | undefined;
|
|
26
24
|
/** Hostname for default message-id values */
|
|
27
|
-
hostname?: string;
|
|
25
|
+
hostname?: string | undefined;
|
|
28
26
|
/** If set to 'win' then uses \r\n, if 'linux' then \n. If not set (or `raw` is used) then newlines are kept as is */
|
|
29
|
-
newline?: string;
|
|
27
|
+
newline?: string | undefined;
|
|
30
28
|
/** Reject content that points to a file path, for this node and every node below it */
|
|
31
|
-
disableFileAccess?: boolean;
|
|
29
|
+
disableFileAccess?: boolean | undefined;
|
|
32
30
|
/** Reject content that points to a URL, for this node and every node below it */
|
|
33
|
-
disableUrlAccess?: boolean;
|
|
31
|
+
disableUrlAccess?: boolean | undefined;
|
|
34
32
|
}
|
|
35
33
|
/**
|
|
36
34
|
* An address object as accepted in address headers and produced by getAddresses. Either a
|
|
37
35
|
* mailbox with an address or a group holding a list of addresses
|
|
38
36
|
*/
|
|
39
37
|
export interface MimeNodeAddress {
|
|
40
|
-
name?: string;
|
|
41
|
-
address?: string;
|
|
42
|
-
group?: MimeNodeAddress[];
|
|
38
|
+
name?: string | undefined;
|
|
39
|
+
address?: string | undefined;
|
|
40
|
+
group?: MimeNodeAddress[] | undefined;
|
|
43
41
|
}
|
|
44
42
|
/**
|
|
45
43
|
* Addresses as accepted by address headers and envelope fields: an address string, an
|
|
@@ -52,8 +50,8 @@ export type MimeNodeAddressInput = string | MimeNodeAddress | MimeNodeAddressInp
|
|
|
52
50
|
*/
|
|
53
51
|
export interface MimeNodePreparedHeaderValue {
|
|
54
52
|
value?: unknown;
|
|
55
|
-
prepared?: boolean;
|
|
56
|
-
foldLines?: boolean;
|
|
53
|
+
prepared?: boolean | undefined;
|
|
54
|
+
foldLines?: boolean | undefined;
|
|
57
55
|
}
|
|
58
56
|
/**
|
|
59
57
|
* The values a header can hold: a string, a number, a Date (for the Date header), address
|
|
@@ -84,19 +82,15 @@ export type MimeNodeHeaders = MimeNodeHeader | MimeNodeHeader[] | MimeNodeHeader
|
|
|
84
82
|
*/
|
|
85
83
|
export interface MimeNodeContentObject {
|
|
86
84
|
/** File path to read the content from */
|
|
87
|
-
path?: string;
|
|
85
|
+
path?: string | undefined;
|
|
88
86
|
/** URL to fetch the content from */
|
|
89
|
-
href?: string;
|
|
87
|
+
href?: string | undefined;
|
|
90
88
|
/** Request headers for a URL fetch */
|
|
91
|
-
httpHeaders?: OutgoingHttpHeaders;
|
|
89
|
+
httpHeaders?: OutgoingHttpHeaders | undefined;
|
|
92
90
|
/** TLS settings for a URL fetch, see nmfetch */
|
|
93
91
|
tls?: {
|
|
94
92
|
[key: string]: any;
|
|
95
|
-
};
|
|
96
|
-
/** Read the content once and reuse the buffered value for every stream. MailComposer sets it on the icalEvent content, which is used twice */
|
|
97
|
-
_resolve?: boolean;
|
|
98
|
-
/** The buffered content once _resolve has run */
|
|
99
|
-
_resolvedValue?: Buffer;
|
|
93
|
+
} | undefined;
|
|
100
94
|
}
|
|
101
95
|
/**
|
|
102
96
|
* Body content as accepted by setContent and setRaw: a string, a Buffer, a readable stream
|
|
@@ -117,22 +111,22 @@ export interface MimeNodeEnvelope {
|
|
|
117
111
|
* other field is copied to the envelope as is
|
|
118
112
|
*/
|
|
119
113
|
export interface MimeNodeEnvelopeInput {
|
|
120
|
-
from?: MimeNodeAddressInput;
|
|
121
|
-
to?: MimeNodeAddressInput;
|
|
122
|
-
cc?: MimeNodeAddressInput;
|
|
123
|
-
bcc?: MimeNodeAddressInput;
|
|
114
|
+
from?: MimeNodeAddressInput | undefined;
|
|
115
|
+
to?: MimeNodeAddressInput | undefined;
|
|
116
|
+
cc?: MimeNodeAddressInput | undefined;
|
|
117
|
+
bcc?: MimeNodeAddressInput | undefined;
|
|
124
118
|
[key: string]: unknown;
|
|
125
119
|
}
|
|
126
120
|
/**
|
|
127
121
|
* Parsed address headers as returned by getAddresses, keyed by lowercase header name
|
|
128
122
|
*/
|
|
129
123
|
export interface MimeNodeAddresses {
|
|
130
|
-
from?: MimeNodeAddress[];
|
|
131
|
-
sender?: MimeNodeAddress[];
|
|
132
|
-
'reply-to'?: MimeNodeAddress[];
|
|
133
|
-
to?: MimeNodeAddress[];
|
|
134
|
-
cc?: MimeNodeAddress[];
|
|
135
|
-
bcc?: MimeNodeAddress[];
|
|
124
|
+
from?: MimeNodeAddress[] | undefined;
|
|
125
|
+
sender?: MimeNodeAddress[] | undefined;
|
|
126
|
+
'reply-to'?: MimeNodeAddress[] | undefined;
|
|
127
|
+
to?: MimeNodeAddress[] | undefined;
|
|
128
|
+
cc?: MimeNodeAddress[] | undefined;
|
|
129
|
+
bcc?: MimeNodeAddress[] | undefined;
|
|
136
130
|
}
|
|
137
131
|
/**
|
|
138
132
|
* Options for createReadStream. Handed to the PassThrough the message is written to and to
|
|
@@ -140,7 +134,7 @@ export interface MimeNodeAddresses {
|
|
|
140
134
|
*/
|
|
141
135
|
export interface MimeNodeStreamOptions extends TransformOptions {
|
|
142
136
|
/** Maximum line length for base64 and quoted-printable bodies, false disables wrapping */
|
|
143
|
-
lineLength?: number | false;
|
|
137
|
+
lineLength?: number | false | undefined;
|
|
144
138
|
}
|
|
145
139
|
/**
|
|
146
140
|
* A transform stream the message is piped through, or a function returning one
|
|
@@ -184,25 +178,16 @@ declare class MimeNode {
|
|
|
184
178
|
hostname: string | undefined;
|
|
185
179
|
newline: string | undefined;
|
|
186
180
|
childNodes: MimeNode[];
|
|
187
|
-
_nodeId: number;
|
|
188
|
-
_headers: MimeNodeHeader[];
|
|
189
|
-
_isPlainText: boolean;
|
|
190
|
-
_hasLongLines: boolean;
|
|
191
|
-
_envelope: MimeNodeEnvelope | false;
|
|
192
|
-
_raw: MimeNodeContent | Error | false;
|
|
193
|
-
_transforms: MimeNodeTransform[];
|
|
194
|
-
_processFuncs: MimeNodeProcessFunc[];
|
|
195
181
|
/** Filename for this node. Useful with attachments */
|
|
196
|
-
filename?: string;
|
|
182
|
+
filename?: string | undefined;
|
|
197
183
|
/** Body content, or the error a content stream emitted before it was read */
|
|
198
|
-
content?: MimeNodeContent | Error;
|
|
184
|
+
content?: MimeNodeContent | Error | undefined;
|
|
199
185
|
/** Lowercase content type, set when the headers are built */
|
|
200
|
-
contentType?: string;
|
|
186
|
+
contentType?: string | undefined;
|
|
201
187
|
/** Multipart subtype, false for a non-multipart node, set when the headers are built */
|
|
202
|
-
multipart?: string | false;
|
|
188
|
+
multipart?: string | false | undefined;
|
|
203
189
|
/** Multipart boundary, false for a non-multipart node, set when the headers are built */
|
|
204
|
-
boundary?: string | false;
|
|
205
|
-
_contentErrorHandler?: (err: Error) => void;
|
|
190
|
+
boundary?: string | false | undefined;
|
|
206
191
|
constructor(contentType?: string | false, options?: MimeNodeOptions);
|
|
207
192
|
/**
|
|
208
193
|
* Creates and appends a child node.Arguments provided are passed to MimeNode constructor
|
|
@@ -333,145 +318,6 @@ declare class MimeNode {
|
|
|
333
318
|
* @param raw Raw MIME contents
|
|
334
319
|
*/
|
|
335
320
|
setRaw(raw: MimeNodeContent): this;
|
|
336
|
-
/**
|
|
337
|
-
* Checks an access policy flag for this node and every node above it. The flags are set
|
|
338
|
-
* from the options the node was built with, and createChild only ever sees the options
|
|
339
|
-
* the caller passed, so a child of a closed tree starts out open. Reading the answer off
|
|
340
|
-
* the parent chain keeps it right whatever order the tree was assembled in.
|
|
341
|
-
*
|
|
342
|
-
* @param flag Either 'disableFileAccess' or 'disableUrlAccess'
|
|
343
|
-
* @return true if this node or an ancestor closed that access
|
|
344
|
-
*/
|
|
345
|
-
_accessDisabled(flag: 'disableFileAccess' | 'disableUrlAccess'): boolean;
|
|
346
|
-
/**
|
|
347
|
-
* Detects and returns handle to a stream related with the content.
|
|
348
|
-
*
|
|
349
|
-
* @param content Node content
|
|
350
|
-
* @returns Stream object
|
|
351
|
-
*/
|
|
352
|
-
_getStream(content: any): Readable;
|
|
353
|
-
/**
|
|
354
|
-
* Parses addresses. Takes in a single address or an array or an
|
|
355
|
-
* array of address arrays (eg. To: [[first group], [second group],...])
|
|
356
|
-
*
|
|
357
|
-
* @param addresses Addresses to be parsed
|
|
358
|
-
* @return An array of address objects
|
|
359
|
-
*/
|
|
360
|
-
_parseAddresses(addresses: MimeNodeAddressInput | undefined): MimeNodeAddress[];
|
|
361
|
-
/**
|
|
362
|
-
* Normalizes the addresses of a freshly parsed address list, groups included.
|
|
363
|
-
*
|
|
364
|
-
* Everything this method returns carries a normalized address, whether it arrived as an
|
|
365
|
-
* object or was parsed out of a header value. Without this the two shapes disagree, and
|
|
366
|
-
* a consumer reading the parsed form back is handed the ambiguous
|
|
367
|
-
* 'user@evil.com@good.com' that the header and the envelope no longer carry.
|
|
368
|
-
*
|
|
369
|
-
* @param parsed An array of address objects, as returned by addressparser
|
|
370
|
-
* @return The same array, with every address normalized
|
|
371
|
-
*/
|
|
372
|
-
_normalizeParsedAddresses(parsed: Address[]): Address[];
|
|
373
|
-
/**
|
|
374
|
-
* Parses the addresses of an explicitly set envelope.
|
|
375
|
-
*
|
|
376
|
-
* An envelope value is an addr-spec and never a display name, so a bare local username
|
|
377
|
-
* such as 'root' is the address here. Header parsing has to read the same value as a
|
|
378
|
-
* display name, as a value with no '@' in it can not be an addr-spec in a header.
|
|
379
|
-
*
|
|
380
|
-
* @param addresses Addresses to be parsed
|
|
381
|
-
* @return An array of address objects
|
|
382
|
-
*/
|
|
383
|
-
_parseEnvelopeAddresses(addresses: MimeNodeAddressInput | undefined): MimeNodeAddress[];
|
|
384
|
-
/**
|
|
385
|
-
* Normalizes a header key, uses Camel-Case form, except for uppercase MIME-
|
|
386
|
-
*
|
|
387
|
-
* @param key Key to be normalized
|
|
388
|
-
* @return key in Camel-Case form
|
|
389
|
-
*/
|
|
390
|
-
_normalizeHeaderKey(key: string): string;
|
|
391
|
-
/**
|
|
392
|
-
* Checks if the content type is multipart and defines boundary if needed.
|
|
393
|
-
* Doesn't return anything, modifies object argument instead.
|
|
394
|
-
*
|
|
395
|
-
* @param structured Parsed header value for 'Content-Type' key
|
|
396
|
-
*/
|
|
397
|
-
_handleContentType(structured: mimeFuncs.StructuredHeaderValue): void;
|
|
398
|
-
/**
|
|
399
|
-
* Generates a multipart boundary value
|
|
400
|
-
*
|
|
401
|
-
* @return boundary value
|
|
402
|
-
*/
|
|
403
|
-
_generateBoundary(): string;
|
|
404
|
-
/**
|
|
405
|
-
* Encodes a header value for use in the generated rfc2822 email.
|
|
406
|
-
*
|
|
407
|
-
* @param key Header key
|
|
408
|
-
* @param value Header value
|
|
409
|
-
*/
|
|
410
|
-
_encodeHeaderValue(key: string, value: MimeNodeHeaderValue): string;
|
|
411
|
-
/**
|
|
412
|
-
* Rebuilds address object using punycode and other adjustments
|
|
413
|
-
*
|
|
414
|
-
* @param addresses An array of address objects
|
|
415
|
-
* @param [uniqueList] An array to be populated with addresses
|
|
416
|
-
* @return address string
|
|
417
|
-
*/
|
|
418
|
-
_convertAddresses(addresses: MimeNodeAddress | MimeNodeAddress[] | undefined, uniqueList?: MimeNodeAddress[], seenAddresses?: Set<string>): string;
|
|
419
|
-
/**
|
|
420
|
-
* Normalizes an email address
|
|
421
|
-
*
|
|
422
|
-
* @param address An array of address objects
|
|
423
|
-
* @return address string
|
|
424
|
-
*/
|
|
425
|
-
_normalizeAddress(address?: string | false): string;
|
|
426
|
-
/**
|
|
427
|
-
* Normalizes the local part of an address into a form that can be emitted as is.
|
|
428
|
-
*
|
|
429
|
-
* A local part is either a dot-atom or a quoted-string, anything else is not a valid
|
|
430
|
-
* addr-spec. The quotes of a quoted local part get lost along the way, and a bare
|
|
431
|
-
* 'user@evil.com@good.com' leaves it to the receiver which '@' splits the domain off,
|
|
432
|
-
* while the split here is always at the last one. So whatever is not already one of
|
|
433
|
-
* the two valid forms goes back out as a quoted-string.
|
|
434
|
-
*
|
|
435
|
-
* @param user Local part of an address
|
|
436
|
-
* @return Local part as a dot-atom or as a quoted-string
|
|
437
|
-
*/
|
|
438
|
-
_normalizeLocalPart(user: string): string;
|
|
439
|
-
/**
|
|
440
|
-
* If needed, mime encodes the name part
|
|
441
|
-
*
|
|
442
|
-
* @param name Name part of an address
|
|
443
|
-
* @returns Mime word encoded string if needed
|
|
444
|
-
*/
|
|
445
|
-
_encodeAddressName(name: string): string;
|
|
446
|
-
/**
|
|
447
|
-
* Encodes an unstructured header value. Such a value can only carry VCHAR and WSP, so a
|
|
448
|
-
* control char or DEL has to be forced into the mime encoded word that a non-ascii value
|
|
449
|
-
* would get anyway. HT stays as it is, it is valid folding whitespace here.
|
|
450
|
-
*
|
|
451
|
-
* @param value Header value to encode
|
|
452
|
-
* @returns Mime word encoded string if needed
|
|
453
|
-
*/
|
|
454
|
-
_encodeHeaderText(value: string): string;
|
|
455
|
-
/**
|
|
456
|
-
* If needed, mime encodes the name part
|
|
457
|
-
*
|
|
458
|
-
* @param name Name part of an address
|
|
459
|
-
* @returns Mime word encoded string if needed
|
|
460
|
-
*/
|
|
461
|
-
_encodeWords(value: string): string;
|
|
462
|
-
/**
|
|
463
|
-
* Detects best mime encoding for a text value
|
|
464
|
-
*
|
|
465
|
-
* @param value Value to check for
|
|
466
|
-
* @return either 'Q' or 'B'
|
|
467
|
-
*/
|
|
468
|
-
_getTextEncoding(value?: string | Buffer): string;
|
|
469
|
-
/**
|
|
470
|
-
* Generates a message id
|
|
471
|
-
*
|
|
472
|
-
* @return Random Message-ID value
|
|
473
|
-
*/
|
|
474
|
-
_generateMessageId(): string;
|
|
475
321
|
}
|
|
476
322
|
/**
|
|
477
323
|
* Type aliases in the layout of @types/nodemailer, so `MimeNode.Options` style references keep working
|