@mavogel/awscdk-rootmail 0.1.8 → 0.1.10
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 +10 -10
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +5 -5
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/schemas/schemas_0.js +4 -4
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliveryDestinationsCommand.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/GetDeliveryDestinationCommand.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutAccountPolicyCommand.d.ts +4 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutDeliveryDestinationCommand.d.ts +2 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/models_0.d.ts +80 -36
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/models_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +1 -1
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +1 -1
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +2 -1
- package/node_modules/@aws-sdk/client-s3/dist-es/models/enums.js +1 -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/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/models/enums.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/enums.d.ts +1 -0
- package/node_modules/@aws-sdk/client-s3/package.json +2 -2
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ses/package.json +1 -1
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +9 -3
- package/node_modules/@aws-sdk/client-ssm/dist-es/models/enums.js +4 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/schemas/schemas_0.js +3 -2
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/DeleteResourcePolicyCommand.d.ts +6 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/PutResourcePolicyCommand.d.ts +12 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/enums.d.ts +12 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_0.d.ts +20 -1
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_1.d.ts +2 -2
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/enums.d.ts +5 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/models_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-ssm/package.json +1 -1
- package/node_modules/@zone-eu/mailsplit/lib/flowed-decoder.js +1 -5
- package/node_modules/@zone-eu/mailsplit/lib/headers.js +35 -25
- package/node_modules/@zone-eu/mailsplit/lib/message-splitter.js +126 -79
- package/node_modules/@zone-eu/mailsplit/lib/mime-node.js +27 -5
- package/node_modules/@zone-eu/mailsplit/lib/node-rewriter.js +3 -2
- package/node_modules/@zone-eu/mailsplit/lib/types.d.ts +0 -3
- package/node_modules/@zone-eu/mailsplit/package.json +5 -5
- package/node_modules/libbase64/.github/workflows/release.yaml +12 -10
- package/node_modules/libbase64/.ncurc.js +7 -1
- package/node_modules/libbase64/CHANGELOG.md +7 -0
- package/node_modules/libbase64/lib/libbase64.js +27 -0
- package/node_modules/libbase64/package.json +4 -4
- package/node_modules/libmime/CHANGELOG.md +14 -0
- package/node_modules/libmime/lib/libmime.js +41 -21
- package/node_modules/libmime/package.json +3 -3
- package/node_modules/libqp/.github/workflows/release.yaml +12 -10
- package/node_modules/libqp/CHANGELOG.md +7 -0
- package/node_modules/libqp/lib/libqp.js +6 -4
- package/node_modules/libqp/package.json +2 -2
- package/node_modules/libqp/test/libqp-test.js +71 -14
- package/node_modules/mailparser/.release-please-manifest.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +42 -0
- package/node_modules/mailparser/README.md +5 -0
- package/node_modules/mailparser/lib/mail-parser.js +107 -32
- package/node_modules/mailparser/lib/simple-parser.js +12 -0
- package/node_modules/mailparser/lib/stream-hash.js +1 -1
- package/node_modules/mailparser/package.json +6 -6
- package/node_modules/nodemailer/CHANGELOG.md +38 -0
- package/node_modules/nodemailer/README.md +1 -1
- package/node_modules/nodemailer/dist/cjs/addressparser/index.d.ts +16 -2
- package/node_modules/nodemailer/dist/cjs/addressparser/index.js +147 -28
- package/node_modules/nodemailer/dist/cjs/base64/index.js +2 -1
- package/node_modules/nodemailer/dist/cjs/dkim/index.d.ts +13 -1
- package/node_modules/nodemailer/dist/cjs/dkim/index.js +25 -8
- package/node_modules/nodemailer/dist/cjs/dkim/message-parser.d.ts +10 -1
- package/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +28 -4
- package/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.d.ts +10 -1
- package/node_modules/nodemailer/dist/cjs/dkim/sign.d.ts +3 -0
- package/node_modules/nodemailer/dist/cjs/dkim/sign.js +18 -1
- package/node_modules/nodemailer/dist/cjs/errors.d.ts +3 -2
- package/node_modules/nodemailer/dist/cjs/fetch/cookies.d.ts +12 -1
- package/node_modules/nodemailer/dist/cjs/fetch/index.d.ts +15 -1
- package/node_modules/nodemailer/dist/cjs/fetch/index.js +39 -64
- package/node_modules/nodemailer/dist/cjs/json-transport/index.d.ts +14 -4
- package/node_modules/nodemailer/dist/cjs/json-transport/index.js +2 -0
- package/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +8 -3
- package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +43 -25
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +11 -4
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +7 -3
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +198 -84
- package/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +5 -2
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +2 -1
- package/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +38 -16
- package/node_modules/nodemailer/dist/cjs/nodemailer.js +1 -0
- 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/punycode/index.js +1 -0
- package/node_modules/nodemailer/dist/cjs/qp/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/qp/index.js +10 -1
- package/node_modules/nodemailer/dist/cjs/sendmail-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/ses-transport/index.d.ts +39 -2
- package/node_modules/nodemailer/dist/cjs/shared/index.d.ts +43 -7
- package/node_modules/nodemailer/dist/cjs/shared/index.js +5 -2
- package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.d.ts +2 -1
- package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.js +32 -24
- package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +13 -5
- package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.js +23 -11
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +59 -24
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +156 -75
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +12 -4
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +39 -11
- package/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.js +27 -31
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +19 -6
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.js +25 -33
- package/node_modules/nodemailer/dist/cjs/stream-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/well-known/services.js +6 -0
- package/node_modules/nodemailer/dist/cjs/xoauth2/index.d.ts +13 -3
- package/node_modules/nodemailer/dist/cjs/xoauth2/index.js +25 -13
- package/node_modules/nodemailer/dist/esm/addressparser/index.d.ts +16 -2
- package/node_modules/nodemailer/dist/esm/addressparser/index.js +147 -27
- package/node_modules/nodemailer/dist/esm/base64/index.js +2 -1
- package/node_modules/nodemailer/dist/esm/dkim/index.d.ts +13 -1
- package/node_modules/nodemailer/dist/esm/dkim/index.js +25 -8
- package/node_modules/nodemailer/dist/esm/dkim/message-parser.d.ts +10 -1
- package/node_modules/nodemailer/dist/esm/dkim/message-parser.js +30 -5
- package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.d.ts +10 -1
- package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js +2 -1
- package/node_modules/nodemailer/dist/esm/dkim/sign.d.ts +3 -0
- package/node_modules/nodemailer/dist/esm/dkim/sign.js +18 -1
- package/node_modules/nodemailer/dist/esm/errors.d.ts +3 -2
- package/node_modules/nodemailer/dist/esm/fetch/cookies.d.ts +12 -1
- package/node_modules/nodemailer/dist/esm/fetch/cookies.js +2 -1
- package/node_modules/nodemailer/dist/esm/fetch/index.d.ts +15 -1
- package/node_modules/nodemailer/dist/esm/fetch/index.js +39 -64
- package/node_modules/nodemailer/dist/esm/json-transport/index.d.ts +14 -4
- package/node_modules/nodemailer/dist/esm/json-transport/index.js +2 -0
- package/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +8 -3
- package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +43 -25
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +11 -4
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +7 -3
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +198 -84
- package/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +5 -2
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +2 -1
- package/node_modules/nodemailer/dist/esm/nodemailer.d.ts +38 -16
- 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/punycode/index.js +1 -0
- package/node_modules/nodemailer/dist/esm/qp/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/qp/index.js +10 -1
- package/node_modules/nodemailer/dist/esm/sendmail-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/ses-transport/index.d.ts +39 -2
- package/node_modules/nodemailer/dist/esm/shared/index.d.ts +43 -7
- package/node_modules/nodemailer/dist/esm/shared/index.js +5 -2
- package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.d.ts +2 -1
- package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js +32 -24
- package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +13 -5
- package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js +23 -11
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +59 -24
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +156 -75
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +12 -4
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.js +39 -11
- package/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js +27 -31
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +19 -6
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.js +25 -33
- package/node_modules/nodemailer/dist/esm/stream-transport/index.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/well-known/services.js +6 -0
- package/node_modules/nodemailer/dist/esm/xoauth2/index.d.ts +13 -3
- package/node_modules/nodemailer/dist/esm/xoauth2/index.js +25 -13
- package/node_modules/nodemailer/dist/well-known/services.json +7 -0
- package/node_modules/nodemailer/package.json +16 -12
- package/package.json +16 -16
- package/renovate.json5 +1 -0
|
@@ -34,6 +34,8 @@ export interface ResolvedHostname {
|
|
|
34
34
|
/** The resolver error when a cached value was used because of it */
|
|
35
35
|
error?: Error | undefined;
|
|
36
36
|
}
|
|
37
|
+
/** The name @types/nodemailer used for ResolvedHostname */
|
|
38
|
+
export type ResolveHostnameValue = ResolvedHostname;
|
|
37
39
|
/**
|
|
38
40
|
* Resolved addresses as stored in the DNS cache
|
|
39
41
|
*/
|
|
@@ -83,6 +85,8 @@ export interface LogEntry {
|
|
|
83
85
|
[key: string]: any;
|
|
84
86
|
}
|
|
85
87
|
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
88
|
+
/** The name @types/nodemailer used for LogLevel */
|
|
89
|
+
export type LoggerLevel = LogLevel;
|
|
86
90
|
/**
|
|
87
91
|
* A logger supplied by the caller, bunyan style. Any object works, a level it does not
|
|
88
92
|
* implement is routed to one it does, see _logFunc
|
|
@@ -104,16 +108,24 @@ export interface GetLoggerOptions {
|
|
|
104
108
|
/** A bunyan compatible logger, true for the default console logger, false or unset for no logging */
|
|
105
109
|
logger?: ExternalLogger | boolean | undefined;
|
|
106
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* A bunyan style log method: a data object followed by a printf style message, or the
|
|
113
|
+
* message alone
|
|
114
|
+
*/
|
|
115
|
+
export interface LogMethod {
|
|
116
|
+
(data: LogEntry | undefined, message?: string, ...args: any[]): void;
|
|
117
|
+
(message?: string, ...args: any[]): void;
|
|
118
|
+
}
|
|
107
119
|
/**
|
|
108
120
|
* The bunyan compatible logger interface returned by getLogger
|
|
109
121
|
*/
|
|
110
122
|
export interface Logger {
|
|
111
|
-
trace
|
|
112
|
-
debug
|
|
113
|
-
info
|
|
114
|
-
warn
|
|
115
|
-
error
|
|
116
|
-
fatal
|
|
123
|
+
trace: LogMethod;
|
|
124
|
+
debug: LogMethod;
|
|
125
|
+
info: LogMethod;
|
|
126
|
+
warn: LogMethod;
|
|
127
|
+
error: LogMethod;
|
|
128
|
+
fatal: LogMethod;
|
|
117
129
|
}
|
|
118
130
|
/**
|
|
119
131
|
* A parsed data URI
|
|
@@ -175,6 +187,7 @@ export declare const parseConnectionUrl: (str?: string | null) => ConnectionUrlO
|
|
|
175
187
|
* creates a default console logger
|
|
176
188
|
*
|
|
177
189
|
* @param [options] Options object that might include 'logger' value
|
|
190
|
+
* @param [defaults] Fields merged into every log entry, overridden by the fields of the entry itself
|
|
178
191
|
* @return bunyan compatible logger
|
|
179
192
|
*/
|
|
180
193
|
export declare const getLogger: (options?: GetLoggerOptions, defaults?: LogEntry) => Logger;
|
|
@@ -198,18 +211,41 @@ export declare const parseDataURI: (uri: unknown) => ParsedDataURI | null;
|
|
|
198
211
|
*
|
|
199
212
|
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
200
213
|
* @param key Property name or an Array index
|
|
201
|
-
* @param [options] Optional access policy: { disableFileAccess, disableUrlAccess }
|
|
202
214
|
* @param callback Callback function with (err, value)
|
|
203
215
|
*/
|
|
204
216
|
export declare function resolveContent(data: {
|
|
205
217
|
[key: string]: any;
|
|
206
218
|
}, key: string | number, callback: ResolveContentCallback): void;
|
|
219
|
+
/**
|
|
220
|
+
* Resolves a String or a Buffer value for content value
|
|
221
|
+
*
|
|
222
|
+
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
223
|
+
* @param key Property name or an Array index
|
|
224
|
+
* @param options Access policy: { disableFileAccess, disableUrlAccess }
|
|
225
|
+
* @param callback Callback function with (err, value)
|
|
226
|
+
*/
|
|
207
227
|
export declare function resolveContent(data: {
|
|
208
228
|
[key: string]: any;
|
|
209
229
|
}, key: string | number, options: ResolveContentOptions | false | undefined, callback: ResolveContentCallback): void;
|
|
230
|
+
/**
|
|
231
|
+
* Resolves a String or a Buffer value for content value
|
|
232
|
+
*
|
|
233
|
+
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
234
|
+
* @param key Property name or an Array index
|
|
235
|
+
* @param [options] Optional access policy: { disableFileAccess, disableUrlAccess }
|
|
236
|
+
* @returns Promise that resolves with the value
|
|
237
|
+
*/
|
|
210
238
|
export declare function resolveContent(data: {
|
|
211
239
|
[key: string]: any;
|
|
212
240
|
}, key: string | number, options?: ResolveContentOptions | false): Promise<any>;
|
|
241
|
+
/**
|
|
242
|
+
* Resolves a String or a Buffer value for content value
|
|
243
|
+
*
|
|
244
|
+
* @param data An object or an Array you want to resolve an element for, see ContentDescriptor for the values it understands
|
|
245
|
+
* @param key Property name or an Array index
|
|
246
|
+
* @param options Access policy: { disableFileAccess, disableUrlAccess }
|
|
247
|
+
* @param callback Callback function with (err, value), a Promise is returned if not set
|
|
248
|
+
*/
|
|
213
249
|
export declare function resolveContent(data: {
|
|
214
250
|
[key: string]: any;
|
|
215
251
|
}, key: string | number, options: ResolveContentOptions | false | undefined, callback: ResolveContentCallback | undefined): Promise<any> | void;
|
|
@@ -318,6 +318,7 @@ export const _logFunc = (logger, level, defaults, data, message, ...args) => {
|
|
|
318
318
|
* creates a default console logger
|
|
319
319
|
*
|
|
320
320
|
* @param [options] Options object that might include 'logger' value
|
|
321
|
+
* @param [defaults] Fields merged into every log entry, overridden by the fields of the entry itself
|
|
321
322
|
* @return bunyan compatible logger
|
|
322
323
|
*/
|
|
323
324
|
export const getLogger = (options, defaults) => {
|
|
@@ -333,8 +334,10 @@ export const getLogger = (options, defaults) => {
|
|
|
333
334
|
}
|
|
334
335
|
const logger = options.logger === true ? createDefaultLogger(levels) : options.logger;
|
|
335
336
|
levels.forEach(level => {
|
|
336
|
-
response[level] = (
|
|
337
|
-
|
|
337
|
+
response[level] = (...args) => {
|
|
338
|
+
// the bunyan forms: a data object first, or the message alone
|
|
339
|
+
const data = typeof args[0] === 'string' ? undefined : args.shift();
|
|
340
|
+
_logFunc(logger, level, defaults, data, ...args);
|
|
338
341
|
};
|
|
339
342
|
});
|
|
340
343
|
return response;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Transform, type TransformOptions } from 'node:stream';
|
|
2
2
|
/**
|
|
3
3
|
* Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
|
|
4
|
-
* Also makes sure that only <CR><LF> sequences are used for linebreaks
|
|
4
|
+
* Also makes sure that only <CR><LF> sequences are used for linebreaks, bare CR and bare LF
|
|
5
|
+
* are both turned into <CR><LF>
|
|
5
6
|
*
|
|
6
7
|
* @param options Stream options
|
|
7
8
|
*/
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Transform } from 'node:stream';
|
|
2
|
+
// bytes inserted into the output, shared as they are only ever copied by Buffer.concat
|
|
3
|
+
const INSERT_LF = Buffer.from('\n');
|
|
4
|
+
const INSERT_LF_DOT = Buffer.from('\n.');
|
|
5
|
+
const INSERT_CR = Buffer.from('\r');
|
|
6
|
+
const INSERT_DOT = Buffer.from('.');
|
|
2
7
|
/**
|
|
3
8
|
* Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
|
|
4
|
-
* Also makes sure that only <CR><LF> sequences are used for linebreaks
|
|
9
|
+
* Also makes sure that only <CR><LF> sequences are used for linebreaks, bare CR and bare LF
|
|
10
|
+
* are both turned into <CR><LF>
|
|
5
11
|
*
|
|
6
12
|
* @param options Stream options
|
|
7
13
|
*/
|
|
@@ -30,33 +36,35 @@ export default class DataStream extends Transform {
|
|
|
30
36
|
}
|
|
31
37
|
this.inByteCount += chunk.length;
|
|
32
38
|
for (i = 0, len = chunk.length; i < len; i++) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const byte = chunk[i];
|
|
40
|
+
const prev = i ? chunk[i - 1] : this.lastByte;
|
|
41
|
+
let insert = false;
|
|
42
|
+
if (prev === 0x0d && byte !== 0x0a) {
|
|
43
|
+
// a bare CR becomes CRLF. A receiver that treats a lone CR as a line end would
|
|
44
|
+
// otherwise see "\r.\r" as the end of the data (SMTP smuggling), so a dot
|
|
45
|
+
// following it is stuffed like at the start of any other line
|
|
46
|
+
insert = byte === 0x2e ? INSERT_LF_DOT : INSERT_LF;
|
|
47
|
+
}
|
|
48
|
+
else if (byte === 0x0a && prev !== 0x0d) {
|
|
49
|
+
// a bare LF becomes CRLF
|
|
50
|
+
insert = INSERT_CR;
|
|
42
51
|
}
|
|
43
|
-
else if (
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
chunklen += 2;
|
|
53
|
-
}
|
|
54
|
-
chunks.push(Buffer.from('\r\n'));
|
|
55
|
-
lastPos = i + 1;
|
|
52
|
+
else if (byte === 0x2e && (prev === 0x0a || prev === false)) {
|
|
53
|
+
// a dot at the start of a line
|
|
54
|
+
insert = INSERT_DOT;
|
|
55
|
+
}
|
|
56
|
+
if (insert) {
|
|
57
|
+
if (i > lastPos) {
|
|
58
|
+
buf = chunk.slice(lastPos, i);
|
|
59
|
+
chunks.push(buf);
|
|
60
|
+
chunklen += buf.length;
|
|
56
61
|
}
|
|
62
|
+
chunks.push(insert);
|
|
63
|
+
chunklen += insert.length;
|
|
64
|
+
lastPos = i;
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
|
-
if (
|
|
67
|
+
if (chunks.length) {
|
|
60
68
|
// add last piece
|
|
61
69
|
if (lastPos < chunk.length) {
|
|
62
70
|
buf = chunk.slice(lastPos);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Minimal HTTP/S proxy client
|
|
3
3
|
*/
|
|
4
4
|
import net from 'node:net';
|
|
5
|
-
import type {
|
|
5
|
+
import type { Callback } from '../errors.js';
|
|
6
6
|
/**
|
|
7
7
|
* TLS options for connecting to an HTTPS proxy
|
|
8
8
|
*/
|
|
@@ -13,7 +13,7 @@ export interface HttpProxyClientOptions {
|
|
|
13
13
|
/**
|
|
14
14
|
* Receives the proxied socket once the CONNECT handshake has succeeded, or the error that prevented it
|
|
15
15
|
*/
|
|
16
|
-
export type HttpProxyClientCallback =
|
|
16
|
+
export type HttpProxyClientCallback = Callback<net.Socket>;
|
|
17
17
|
/**
|
|
18
18
|
* Establishes proxied connection to destinationPort
|
|
19
19
|
*
|
|
@@ -21,13 +21,21 @@ export type HttpProxyClientCallback = (err: NodemailerError | null, socket?: net
|
|
|
21
21
|
* socket.write("GET / HTTP/1.0\r\n\r\n");
|
|
22
22
|
* });
|
|
23
23
|
*
|
|
24
|
-
* @param proxyUrl proxy configuration,
|
|
24
|
+
* @param proxyUrl proxy configuration, e.g. "http://proxy.host:3128/"
|
|
25
25
|
* @param destinationPort Port to open in destination host
|
|
26
26
|
* @param destinationHost Destination hostname
|
|
27
|
-
* @param
|
|
28
|
-
* @param callback Callback to run with the rocket object once connection is established
|
|
27
|
+
* @param callback Callback to run with the socket object once connection is established
|
|
29
28
|
*/
|
|
30
29
|
declare function httpProxyClient(proxyUrl: string, destinationPort: number | string, destinationHost: string, callback: HttpProxyClientCallback): void;
|
|
30
|
+
/**
|
|
31
|
+
* Establishes proxied connection to destinationPort through an HTTPS proxy
|
|
32
|
+
*
|
|
33
|
+
* @param proxyUrl proxy configuration, e.g. "https://proxy.host:3128/"
|
|
34
|
+
* @param destinationPort Port to open in destination host
|
|
35
|
+
* @param destinationHost Destination hostname
|
|
36
|
+
* @param tlsOptions TLS options for the proxy connection (e.g. { rejectUnauthorized: false })
|
|
37
|
+
* @param callback Callback to run with the socket object once connection is established
|
|
38
|
+
*/
|
|
31
39
|
declare function httpProxyClient(proxyUrl: string, destinationPort: number | string, destinationHost: string, tlsOptions: HttpProxyClientOptions | undefined, callback: HttpProxyClientCallback): void;
|
|
32
40
|
/**
|
|
33
41
|
* Socket timeout in milliseconds while the CONNECT handshake is in progress, defaults to 30 seconds.
|
|
@@ -14,6 +14,8 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
14
14
|
tlsOptions = {};
|
|
15
15
|
}
|
|
16
16
|
tlsOptions = tlsOptions || {};
|
|
17
|
+
// the error paths hand over the error alone
|
|
18
|
+
const done = callback;
|
|
17
19
|
// Reject CRLF in the destination before it reaches the CONNECT request line
|
|
18
20
|
// and Host header. A tainted host/port could otherwise inject additional
|
|
19
21
|
// request headers into the proxy connection (HTTP request splitting).
|
|
@@ -21,7 +23,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
21
23
|
if (!destinationPort || /[\r\n]/.test(destinationHost)) {
|
|
22
24
|
const err = new Error('Invalid proxy destination');
|
|
23
25
|
err.code = errors.EPROXY;
|
|
24
|
-
setImmediate(() =>
|
|
26
|
+
setImmediate(() => done(err));
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
27
29
|
const proxy = urllib.parse(proxyUrl);
|
|
@@ -55,7 +57,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
55
57
|
catch (_E) {
|
|
56
58
|
// ignore
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
done(err);
|
|
59
61
|
};
|
|
60
62
|
const timeoutErr = () => {
|
|
61
63
|
const err = new Error('Proxy socket timed out');
|
|
@@ -86,18 +88,28 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
86
88
|
.join('\r\n') +
|
|
87
89
|
// End request
|
|
88
90
|
'\r\n\r\n');
|
|
89
|
-
|
|
91
|
+
// The response is collected as chunks and only the bytes that just arrived, together
|
|
92
|
+
// with the three before them, are searched for the end of the headers. Appending to a
|
|
93
|
+
// string and searching all of it again re-read the whole response on every chunk.
|
|
94
|
+
const chunks = [];
|
|
95
|
+
let received = 0;
|
|
96
|
+
let tail = '';
|
|
90
97
|
const onSocketData = (chunk) => {
|
|
91
98
|
let match;
|
|
92
|
-
let remainder;
|
|
93
99
|
if (finished) {
|
|
94
100
|
return;
|
|
95
101
|
}
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
const window = tail + chunk.toString('binary');
|
|
103
|
+
const windowEnd = window.indexOf('\r\n\r\n');
|
|
104
|
+
chunks.push(chunk);
|
|
105
|
+
received += chunk.length;
|
|
106
|
+
tail = window.slice(-3);
|
|
107
|
+
if (windowEnd >= 0) {
|
|
98
108
|
socket.removeListener('data', onSocketData);
|
|
99
|
-
|
|
100
|
-
|
|
109
|
+
const headerEnd = received - window.length + windowEnd;
|
|
110
|
+
const response = Buffer.concat(chunks, received).toString('binary');
|
|
111
|
+
const headers = response.substr(0, headerEnd);
|
|
112
|
+
const remainder = response.substr(headerEnd + 4);
|
|
101
113
|
if (remainder) {
|
|
102
114
|
socket.unshift(Buffer.from(remainder, 'binary'));
|
|
103
115
|
}
|
|
@@ -114,14 +126,14 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
|
|
|
114
126
|
}
|
|
115
127
|
const err = new Error('Invalid response from proxy' + ((match && ': ' + match[1]) || ''));
|
|
116
128
|
err.code = errors.EPROXY;
|
|
117
|
-
return
|
|
129
|
+
return done(err);
|
|
118
130
|
}
|
|
119
131
|
socket.removeListener('error', tempSocketErr);
|
|
120
132
|
socket.removeListener('timeout', timeoutErr);
|
|
121
133
|
socket.setTimeout(0);
|
|
122
|
-
return
|
|
134
|
+
return done(null, socket);
|
|
123
135
|
}
|
|
124
|
-
if (
|
|
136
|
+
if (received > MAX_RESPONSE_HEADER_BYTES) {
|
|
125
137
|
socket.removeListener('data', onSocketData);
|
|
126
138
|
const err = new Error('Proxy response headers too large');
|
|
127
139
|
err.code = errors.EPROXY;
|
|
@@ -3,8 +3,9 @@ import net from 'node:net';
|
|
|
3
3
|
import tls from 'node:tls';
|
|
4
4
|
import { type Readable } from 'node:stream';
|
|
5
5
|
import * as shared from '../shared/index.js';
|
|
6
|
-
import type { NodemailerError } from '../errors.js';
|
|
6
|
+
import type { Callback, NodemailerError } from '../errors.js';
|
|
7
7
|
import type XOAuth2 from '../xoauth2/index.js';
|
|
8
|
+
import type { XOAuth2Options } from '../xoauth2/index.js';
|
|
8
9
|
/**
|
|
9
10
|
* Custom authentication handlers keyed by (case insensitive) SASL method name
|
|
10
11
|
*/
|
|
@@ -25,11 +26,11 @@ export interface SMTPConnectionOptions {
|
|
|
25
26
|
secured?: boolean | undefined;
|
|
26
27
|
/** Server name for SNI, defaults to host when that is not an IP address */
|
|
27
28
|
servername?: string | undefined;
|
|
28
|
-
/** Ignore STARTTLS even when the server advertises it */
|
|
29
|
+
/** Ignore STARTTLS even when the server advertises it, has no effect when requireTLS is set */
|
|
29
30
|
ignoreTLS?: boolean | undefined;
|
|
30
|
-
/** Force STARTTLS, fail when the server does not support it */
|
|
31
|
+
/** Force STARTTLS, fail when the server does not support it. Takes precedence over ignoreTLS and opportunisticTLS */
|
|
31
32
|
requireTLS?: boolean | undefined;
|
|
32
|
-
/** Continue unencrypted when the STARTTLS upgrade fails */
|
|
33
|
+
/** Continue unencrypted when the STARTTLS upgrade fails, has no effect when requireTLS is set */
|
|
33
34
|
opportunisticTLS?: boolean | undefined;
|
|
34
35
|
/** Name of the client server, sent with EHLO/HELO, CRLF is stripped */
|
|
35
36
|
name?: string | undefined;
|
|
@@ -117,12 +118,23 @@ export interface SMTPConnectionCustomAuthResponse {
|
|
|
117
118
|
* Callback for a command sent by a custom authentication handler
|
|
118
119
|
*/
|
|
119
120
|
export type SMTPConnectionCustomAuthCommandCallback = (err: Error | null, data: SMTPConnectionCustomAuthResponse) => void;
|
|
121
|
+
/**
|
|
122
|
+
* The auth object as a custom authentication handler sees it: the object handed to login()
|
|
123
|
+
* with the credentials filled in from its user and pass values
|
|
124
|
+
*/
|
|
125
|
+
export interface SMTPConnectionCustomAuthData extends SMTPConnectionAuth {
|
|
126
|
+
/** The user and pass values of the auth object, the way @types/nodemailer declared them */
|
|
127
|
+
credentials: SMTPConnectionCredentials & {
|
|
128
|
+
user: string;
|
|
129
|
+
pass: string;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
120
132
|
/**
|
|
121
133
|
* The object a custom authentication handler is run with
|
|
122
134
|
*/
|
|
123
135
|
export interface SMTPConnectionCustomAuthContext {
|
|
124
|
-
/** The auth object handed to login() */
|
|
125
|
-
auth:
|
|
136
|
+
/** The auth object handed to login(), with the credentials filled in */
|
|
137
|
+
auth: SMTPConnectionCustomAuthData;
|
|
126
138
|
/** Selected authentication method name */
|
|
127
139
|
method: string;
|
|
128
140
|
/** SMTP extensions the server advertised */
|
|
@@ -131,17 +143,20 @@ export interface SMTPConnectionCustomAuthContext {
|
|
|
131
143
|
authMethods: string[];
|
|
132
144
|
/** Maximum message size the server accepts, false when not advertised */
|
|
133
145
|
maxAllowedSize: number | false;
|
|
134
|
-
/** Sends a command to the server
|
|
135
|
-
sendCommand(cmd: string
|
|
146
|
+
/** Sends a command to the server and resolves with the parsed reply */
|
|
147
|
+
sendCommand(cmd: string): Promise<SMTPConnectionCustomAuthResponse>;
|
|
148
|
+
/** Sends a command to the server and hands the parsed reply to the callback */
|
|
149
|
+
sendCommand(cmd: string, done: SMTPConnectionCustomAuthCommandCallback): void;
|
|
136
150
|
/** Marks the user as authenticated */
|
|
137
151
|
resolve(): void;
|
|
138
152
|
/** Fails the authentication with an error */
|
|
139
153
|
reject(err: Error | string): void;
|
|
140
154
|
}
|
|
141
155
|
/**
|
|
142
|
-
* A custom authentication handler. Calls resolve() or reject() on the context, or returns a
|
|
156
|
+
* A custom authentication handler. Calls resolve() or reject() on the context, or returns a
|
|
157
|
+
* promise that settles the authentication. Any other return value is ignored
|
|
143
158
|
*/
|
|
144
|
-
export type SMTPConnectionCustomAuthHandler = (ctx: SMTPConnectionCustomAuthContext) =>
|
|
159
|
+
export type SMTPConnectionCustomAuthHandler = (ctx: SMTPConnectionCustomAuthContext) => unknown;
|
|
145
160
|
/**
|
|
146
161
|
* An envelope address, either a plain string or an object with an address property
|
|
147
162
|
*/
|
|
@@ -168,12 +183,16 @@ export interface SMTPEnvelopeDsn {
|
|
|
168
183
|
/** Alias of recipient, in the 'rfc822;address' form */
|
|
169
184
|
orcpt?: string | null | undefined;
|
|
170
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* A single DSN notify value
|
|
188
|
+
*/
|
|
189
|
+
export type SMTPEnvelopeDsnNotify = 'NEVER' | 'SUCCESS' | 'FAILURE' | 'DELAY';
|
|
171
190
|
/**
|
|
172
191
|
* Envelope object accepted by send()
|
|
173
192
|
*/
|
|
174
193
|
export interface SMTPEnvelope {
|
|
175
|
-
/** Sender address */
|
|
176
|
-
from?: string | SMTPEnvelopeAddress | undefined;
|
|
194
|
+
/** Sender address, false for the null sender of a bounce message (MAIL FROM:<>) */
|
|
195
|
+
from?: string | SMTPEnvelopeAddress | false | undefined;
|
|
177
196
|
/** Recipient address or addresses */
|
|
178
197
|
to?: string | SMTPEnvelopeAddress | Array<string | SMTPEnvelopeAddress> | undefined;
|
|
179
198
|
/** Message size in bytes, sent as the SIZE parameter when the server supports it */
|
|
@@ -202,9 +221,9 @@ export interface SMTPConnectionEnvelope extends SMTPEnvelope {
|
|
|
202
221
|
accepted: string[];
|
|
203
222
|
}
|
|
204
223
|
/**
|
|
205
|
-
*
|
|
224
|
+
* The recipient bookkeeping of a sent message, known once the envelope is accepted
|
|
206
225
|
*/
|
|
207
|
-
export interface
|
|
226
|
+
export interface SMTPConnectionEnvelopeInfo {
|
|
208
227
|
/** Recipients the server accepted */
|
|
209
228
|
accepted: string[];
|
|
210
229
|
/** Recipients the server rejected */
|
|
@@ -213,19 +232,25 @@ export interface SMTPConnectionSendInfo {
|
|
|
213
232
|
ehlo?: string[] | undefined;
|
|
214
233
|
/** Errors for the rejected recipients */
|
|
215
234
|
rejectedErrors?: NodemailerError[] | undefined;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Result of a sent message
|
|
238
|
+
*/
|
|
239
|
+
export interface SMTPConnectionSendInfo extends SMTPConnectionEnvelopeInfo {
|
|
216
240
|
/** Time in ms spent on the envelope commands */
|
|
217
|
-
envelopeTime
|
|
241
|
+
envelopeTime: number;
|
|
218
242
|
/** Time in ms spent on streaming the message */
|
|
219
|
-
messageTime
|
|
243
|
+
messageTime: number;
|
|
220
244
|
/** Size of the encoded message in bytes */
|
|
221
|
-
messageSize
|
|
245
|
+
messageSize: number;
|
|
222
246
|
/** Final server response for the message */
|
|
223
|
-
response
|
|
247
|
+
response: string;
|
|
224
248
|
}
|
|
225
249
|
/**
|
|
226
|
-
* Callback for send()
|
|
250
|
+
* Callback for send(), receives the result once the server accepted the message. The error
|
|
251
|
+
* path hands over the error alone
|
|
227
252
|
*/
|
|
228
|
-
export type SMTPConnectionSendCallback =
|
|
253
|
+
export type SMTPConnectionSendCallback = Callback<SMTPConnectionSendInfo>;
|
|
229
254
|
/**
|
|
230
255
|
* Callback for login() and reset(), the result is true on success
|
|
231
256
|
*/
|
|
@@ -263,8 +288,8 @@ export type SMTPConnectionResponseAction = (str: string) => void;
|
|
|
263
288
|
* * **port** - is the port to connect to (defaults to 587 or 465)
|
|
264
289
|
* * **host** - is the hostname or IP address to connect to (defaults to 'localhost')
|
|
265
290
|
* * **secure** - use SSL
|
|
266
|
-
* * **ignoreTLS** - ignore server support for STARTTLS
|
|
267
|
-
* * **requireTLS** - forces the client to use STARTTLS
|
|
291
|
+
* * **ignoreTLS** - ignore server support for STARTTLS (has no effect when requireTLS is set)
|
|
292
|
+
* * **requireTLS** - forces the client to use STARTTLS, takes precedence over ignoreTLS and opportunisticTLS
|
|
268
293
|
* * **name** - the name of the client server
|
|
269
294
|
* * **localAddress** - outbound address to bind to (see: http://nodejs.org/api/net.html#net_net_connect_options_connectionlistener)
|
|
270
295
|
* * **greetingTimeout** - Time to wait in ms until greeting message is received from the server (defaults to 30 seconds)
|
|
@@ -285,7 +310,7 @@ export type SMTPConnectionResponseAction = (str: string) => void;
|
|
|
285
310
|
*/
|
|
286
311
|
declare class SMTPConnection extends EventEmitter {
|
|
287
312
|
id: string;
|
|
288
|
-
stage:
|
|
313
|
+
stage: 'init' | 'connected';
|
|
289
314
|
options: SMTPConnectionOptions;
|
|
290
315
|
secureConnection: boolean;
|
|
291
316
|
alreadySecured: boolean;
|
|
@@ -354,7 +379,7 @@ declare class SMTPConnection extends EventEmitter {
|
|
|
354
379
|
*
|
|
355
380
|
* @param envelope Envelope object, {from: addr, to: [addr]}
|
|
356
381
|
* @param message String, Buffer or a Stream
|
|
357
|
-
* @param
|
|
382
|
+
* @param done Callback to return once sending is completed
|
|
358
383
|
*/
|
|
359
384
|
send(envelope: SMTPEnvelope, message: string | Buffer | Readable, done: SMTPConnectionSendCallback): void;
|
|
360
385
|
/**
|
|
@@ -370,12 +395,22 @@ declare class SMTPConnection extends EventEmitter {
|
|
|
370
395
|
declare namespace SMTPConnection {
|
|
371
396
|
type Options = SMTPConnectionOptions;
|
|
372
397
|
type AuthenticationType = SMTPConnectionAuth;
|
|
398
|
+
type AuthenticationTypeLogin = SMTPConnectionAuth;
|
|
399
|
+
type AuthenticationTypeOAuth2 = SMTPConnectionAuth;
|
|
400
|
+
type AuthenticationTypeCustom = SMTPConnectionAuth;
|
|
401
|
+
type AuthenticationCredentials = SMTPConnectionAuth;
|
|
402
|
+
type AuthenticationOAuth2 = SMTPConnectionAuth;
|
|
373
403
|
type Credentials = SMTPConnectionCredentials;
|
|
404
|
+
type OAuth2 = XOAuth2Options;
|
|
374
405
|
type Envelope = SMTPEnvelope;
|
|
375
406
|
type DSNOptions = SMTPEnvelopeDsn;
|
|
407
|
+
type DSNOption = SMTPEnvelopeDsnNotify;
|
|
376
408
|
type SentMessageInfo = SMTPConnectionSendInfo;
|
|
409
|
+
type SMTPError = NodemailerError;
|
|
377
410
|
type CustomAuthenticationContext = SMTPConnectionCustomAuthContext;
|
|
378
411
|
type CustomAuthenticationResponse = SMTPConnectionCustomAuthResponse;
|
|
379
412
|
type CustomAuthenticationHandlers = SMTPConnectionCustomAuthHandlers;
|
|
380
413
|
}
|
|
414
|
+
/** The same aliases as module level exports, for `import * as SMTPConnection` and `import SMTPConnection = require()` */
|
|
415
|
+
export type { SMTPConnectionOptions as Options, SMTPConnectionAuth as AuthenticationType, SMTPConnectionAuth as AuthenticationTypeLogin, SMTPConnectionAuth as AuthenticationTypeOAuth2, SMTPConnectionAuth as AuthenticationTypeCustom, SMTPConnectionAuth as AuthenticationCredentials, SMTPConnectionAuth as AuthenticationOAuth2, SMTPConnectionCredentials as Credentials, XOAuth2Options as OAuth2, SMTPEnvelope as Envelope, SMTPEnvelopeDsn as DSNOptions, SMTPEnvelopeDsnNotify as DSNOption, SMTPConnectionSendInfo as SentMessageInfo, NodemailerError as SMTPError, SMTPConnectionCustomAuthContext as CustomAuthenticationContext, SMTPConnectionCustomAuthResponse as CustomAuthenticationResponse, SMTPConnectionCustomAuthHandlers as CustomAuthenticationHandlers };
|
|
381
416
|
export default SMTPConnection;
|