@mavogel/awscdk-rootmail 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/.jsii +10 -10
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +5 -5
  5. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/schemas/schemas_0.js +4 -4
  6. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/DescribeDeliveryDestinationsCommand.d.ts +1 -0
  7. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/GetDeliveryDestinationCommand.d.ts +1 -0
  8. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutAccountPolicyCommand.d.ts +4 -1
  9. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/commands/PutDeliveryDestinationCommand.d.ts +2 -0
  10. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/models/models_0.d.ts +80 -36
  11. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/models/models_0.d.ts +2 -0
  12. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +1 -1
  13. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
  14. package/node_modules/@aws-sdk/client-route-53/package.json +1 -1
  15. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +2 -1
  16. package/node_modules/@aws-sdk/client-s3/dist-es/models/enums.js +1 -0
  17. package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetBucketInventoryConfigurationCommand.d.ts +1 -1
  18. package/node_modules/@aws-sdk/client-s3/dist-types/commands/ListBucketInventoryConfigurationsCommand.d.ts +1 -1
  19. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutBucketInventoryConfigurationCommand.d.ts +1 -1
  20. package/node_modules/@aws-sdk/client-s3/dist-types/models/enums.d.ts +1 -0
  21. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/models/enums.d.ts +1 -0
  22. package/node_modules/@aws-sdk/client-s3/package.json +2 -2
  23. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
  24. package/node_modules/@aws-sdk/client-ses/package.json +1 -1
  25. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +9 -3
  26. package/node_modules/@aws-sdk/client-ssm/dist-es/models/enums.js +4 -0
  27. package/node_modules/@aws-sdk/client-ssm/dist-es/schemas/schemas_0.js +3 -2
  28. package/node_modules/@aws-sdk/client-ssm/dist-types/commands/DeleteResourcePolicyCommand.d.ts +6 -0
  29. package/node_modules/@aws-sdk/client-ssm/dist-types/commands/PutResourcePolicyCommand.d.ts +12 -0
  30. package/node_modules/@aws-sdk/client-ssm/dist-types/models/enums.d.ts +12 -0
  31. package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_0.d.ts +20 -1
  32. package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_1.d.ts +2 -2
  33. package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/enums.d.ts +5 -0
  34. package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/models_0.d.ts +2 -0
  35. package/node_modules/@aws-sdk/client-ssm/package.json +1 -1
  36. package/node_modules/@zone-eu/mailsplit/lib/flowed-decoder.js +1 -5
  37. package/node_modules/@zone-eu/mailsplit/lib/headers.js +35 -25
  38. package/node_modules/@zone-eu/mailsplit/lib/message-splitter.js +126 -79
  39. package/node_modules/@zone-eu/mailsplit/lib/mime-node.js +27 -5
  40. package/node_modules/@zone-eu/mailsplit/lib/node-rewriter.js +3 -2
  41. package/node_modules/@zone-eu/mailsplit/lib/types.d.ts +0 -3
  42. package/node_modules/@zone-eu/mailsplit/package.json +5 -5
  43. package/node_modules/libbase64/.github/workflows/release.yaml +12 -10
  44. package/node_modules/libbase64/.ncurc.js +7 -1
  45. package/node_modules/libbase64/CHANGELOG.md +7 -0
  46. package/node_modules/libbase64/lib/libbase64.js +27 -0
  47. package/node_modules/libbase64/package.json +4 -4
  48. package/node_modules/libmime/CHANGELOG.md +14 -0
  49. package/node_modules/libmime/lib/libmime.js +41 -21
  50. package/node_modules/libmime/package.json +3 -3
  51. package/node_modules/libqp/.github/workflows/release.yaml +12 -10
  52. package/node_modules/libqp/CHANGELOG.md +7 -0
  53. package/node_modules/libqp/lib/libqp.js +6 -4
  54. package/node_modules/libqp/package.json +2 -2
  55. package/node_modules/libqp/test/libqp-test.js +71 -14
  56. package/node_modules/mailparser/.release-please-manifest.json +1 -1
  57. package/node_modules/mailparser/CHANGELOG.md +42 -0
  58. package/node_modules/mailparser/README.md +5 -0
  59. package/node_modules/mailparser/lib/mail-parser.js +107 -32
  60. package/node_modules/mailparser/lib/simple-parser.js +12 -0
  61. package/node_modules/mailparser/lib/stream-hash.js +1 -1
  62. package/node_modules/mailparser/package.json +6 -6
  63. package/node_modules/nodemailer/CHANGELOG.md +38 -0
  64. package/node_modules/nodemailer/README.md +1 -1
  65. package/node_modules/nodemailer/dist/cjs/addressparser/index.d.ts +16 -2
  66. package/node_modules/nodemailer/dist/cjs/addressparser/index.js +147 -28
  67. package/node_modules/nodemailer/dist/cjs/base64/index.js +2 -1
  68. package/node_modules/nodemailer/dist/cjs/dkim/index.d.ts +13 -1
  69. package/node_modules/nodemailer/dist/cjs/dkim/index.js +25 -8
  70. package/node_modules/nodemailer/dist/cjs/dkim/message-parser.d.ts +10 -1
  71. package/node_modules/nodemailer/dist/cjs/dkim/message-parser.js +28 -4
  72. package/node_modules/nodemailer/dist/cjs/dkim/relaxed-body.d.ts +10 -1
  73. package/node_modules/nodemailer/dist/cjs/dkim/sign.d.ts +3 -0
  74. package/node_modules/nodemailer/dist/cjs/dkim/sign.js +18 -1
  75. package/node_modules/nodemailer/dist/cjs/errors.d.ts +3 -2
  76. package/node_modules/nodemailer/dist/cjs/fetch/cookies.d.ts +12 -1
  77. package/node_modules/nodemailer/dist/cjs/fetch/index.d.ts +15 -1
  78. package/node_modules/nodemailer/dist/cjs/fetch/index.js +39 -64
  79. package/node_modules/nodemailer/dist/cjs/json-transport/index.d.ts +14 -4
  80. package/node_modules/nodemailer/dist/cjs/json-transport/index.js +2 -0
  81. package/node_modules/nodemailer/dist/cjs/mail-composer/index.d.ts +8 -3
  82. package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +43 -25
  83. package/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +11 -4
  84. package/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +7 -3
  85. package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +198 -84
  86. package/node_modules/nodemailer/dist/cjs/mime-node/index.d.ts +5 -2
  87. package/node_modules/nodemailer/dist/cjs/mime-node/index.js +2 -1
  88. package/node_modules/nodemailer/dist/cjs/nodemailer.d.ts +38 -16
  89. package/node_modules/nodemailer/dist/cjs/nodemailer.js +1 -0
  90. package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
  91. package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
  92. package/node_modules/nodemailer/dist/cjs/punycode/index.js +1 -0
  93. package/node_modules/nodemailer/dist/cjs/qp/index.d.ts +2 -0
  94. package/node_modules/nodemailer/dist/cjs/qp/index.js +10 -1
  95. package/node_modules/nodemailer/dist/cjs/sendmail-transport/index.d.ts +2 -0
  96. package/node_modules/nodemailer/dist/cjs/ses-transport/index.d.ts +39 -2
  97. package/node_modules/nodemailer/dist/cjs/shared/index.d.ts +43 -7
  98. package/node_modules/nodemailer/dist/cjs/shared/index.js +5 -2
  99. package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.d.ts +2 -1
  100. package/node_modules/nodemailer/dist/cjs/smtp-connection/data-stream.js +32 -24
  101. package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.d.ts +13 -5
  102. package/node_modules/nodemailer/dist/cjs/smtp-connection/http-proxy-client.js +23 -11
  103. package/node_modules/nodemailer/dist/cjs/smtp-connection/index.d.ts +59 -24
  104. package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +156 -75
  105. package/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +12 -4
  106. package/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +39 -11
  107. package/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.js +27 -31
  108. package/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +19 -6
  109. package/node_modules/nodemailer/dist/cjs/smtp-transport/index.js +25 -33
  110. package/node_modules/nodemailer/dist/cjs/stream-transport/index.d.ts +2 -0
  111. package/node_modules/nodemailer/dist/cjs/well-known/services.js +6 -0
  112. package/node_modules/nodemailer/dist/cjs/xoauth2/index.d.ts +13 -3
  113. package/node_modules/nodemailer/dist/cjs/xoauth2/index.js +25 -13
  114. package/node_modules/nodemailer/dist/esm/addressparser/index.d.ts +16 -2
  115. package/node_modules/nodemailer/dist/esm/addressparser/index.js +147 -27
  116. package/node_modules/nodemailer/dist/esm/base64/index.js +2 -1
  117. package/node_modules/nodemailer/dist/esm/dkim/index.d.ts +13 -1
  118. package/node_modules/nodemailer/dist/esm/dkim/index.js +25 -8
  119. package/node_modules/nodemailer/dist/esm/dkim/message-parser.d.ts +10 -1
  120. package/node_modules/nodemailer/dist/esm/dkim/message-parser.js +30 -5
  121. package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.d.ts +10 -1
  122. package/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js +2 -1
  123. package/node_modules/nodemailer/dist/esm/dkim/sign.d.ts +3 -0
  124. package/node_modules/nodemailer/dist/esm/dkim/sign.js +18 -1
  125. package/node_modules/nodemailer/dist/esm/errors.d.ts +3 -2
  126. package/node_modules/nodemailer/dist/esm/fetch/cookies.d.ts +12 -1
  127. package/node_modules/nodemailer/dist/esm/fetch/cookies.js +2 -1
  128. package/node_modules/nodemailer/dist/esm/fetch/index.d.ts +15 -1
  129. package/node_modules/nodemailer/dist/esm/fetch/index.js +39 -64
  130. package/node_modules/nodemailer/dist/esm/json-transport/index.d.ts +14 -4
  131. package/node_modules/nodemailer/dist/esm/json-transport/index.js +2 -0
  132. package/node_modules/nodemailer/dist/esm/mail-composer/index.d.ts +8 -3
  133. package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +43 -25
  134. package/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +11 -4
  135. package/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +7 -3
  136. package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +198 -84
  137. package/node_modules/nodemailer/dist/esm/mime-node/index.d.ts +5 -2
  138. package/node_modules/nodemailer/dist/esm/mime-node/index.js +2 -1
  139. package/node_modules/nodemailer/dist/esm/nodemailer.d.ts +38 -16
  140. package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
  141. package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
  142. package/node_modules/nodemailer/dist/esm/punycode/index.js +1 -0
  143. package/node_modules/nodemailer/dist/esm/qp/index.d.ts +2 -0
  144. package/node_modules/nodemailer/dist/esm/qp/index.js +10 -1
  145. package/node_modules/nodemailer/dist/esm/sendmail-transport/index.d.ts +2 -0
  146. package/node_modules/nodemailer/dist/esm/ses-transport/index.d.ts +39 -2
  147. package/node_modules/nodemailer/dist/esm/shared/index.d.ts +43 -7
  148. package/node_modules/nodemailer/dist/esm/shared/index.js +5 -2
  149. package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.d.ts +2 -1
  150. package/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js +32 -24
  151. package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.d.ts +13 -5
  152. package/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js +23 -11
  153. package/node_modules/nodemailer/dist/esm/smtp-connection/index.d.ts +59 -24
  154. package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +156 -75
  155. package/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +12 -4
  156. package/node_modules/nodemailer/dist/esm/smtp-pool/index.js +39 -11
  157. package/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js +27 -31
  158. package/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +19 -6
  159. package/node_modules/nodemailer/dist/esm/smtp-transport/index.js +25 -33
  160. package/node_modules/nodemailer/dist/esm/stream-transport/index.d.ts +2 -0
  161. package/node_modules/nodemailer/dist/esm/well-known/services.js +6 -0
  162. package/node_modules/nodemailer/dist/esm/xoauth2/index.d.ts +13 -3
  163. package/node_modules/nodemailer/dist/esm/xoauth2/index.js +25 -13
  164. package/node_modules/nodemailer/dist/well-known/services.json +7 -0
  165. package/node_modules/nodemailer/package.json +16 -12
  166. package/package.json +18 -16
  167. package/renovate.json5 +59 -0
@@ -1294,6 +1294,7 @@ class MimeNode {
1294
1294
  *
1295
1295
  * @param addresses An array of address objects
1296
1296
  * @param [uniqueList] An array to be populated with addresses
1297
+ * @param [seenAddresses] Addresses already added to uniqueList, shared with recursive calls to keep deduplication linear
1297
1298
  * @return address string
1298
1299
  * @internal
1299
1300
  */
@@ -1431,7 +1432,7 @@ class MimeNode {
1431
1432
  /**
1432
1433
  * If needed, mime encodes the name part
1433
1434
  *
1434
- * @param name Name part of an address
1435
+ * @param value Name part of an address
1435
1436
  * @returns Mime word encoded string if needed
1436
1437
  * @internal
1437
1438
  */
@@ -1,10 +1,16 @@
1
1
  import Mail from './mailer/index.js';
2
2
  import type { MailDefaults, SentMessageInfo, Transport, TransportOptions } from './mailer/index.js';
3
+ import SMTPPool from './smtp-pool/index.js';
3
4
  import type { SMTPPoolOptions, SMTPPoolSentMessageInfo } from './smtp-pool/index.js';
5
+ import SMTPTransport from './smtp-transport/index.js';
4
6
  import type { SMTPTransportOptions, SMTPSentMessageInfo } from './smtp-transport/index.js';
7
+ import SendmailTransport from './sendmail-transport/index.js';
5
8
  import type { SendmailTransportOptions, SendmailSentMessageInfo } from './sendmail-transport/index.js';
9
+ import StreamTransport from './stream-transport/index.js';
6
10
  import type { StreamTransportOptions, StreamSentMessageInfo } from './stream-transport/index.js';
7
- import type { JSONTransportOptions, JSONSentMessageInfo } from './json-transport/index.js';
11
+ import JSONTransport from './json-transport/index.js';
12
+ import type { JSONTransportOptions, JSONSentMessageInfo, JSONSentMessageObjectInfo } from './json-transport/index.js';
13
+ import SESTransport from './ses-transport/index.js';
8
14
  import type { SESTransportOptions, SESSentMessageInfo } from './ses-transport/index.js';
9
15
  /**
10
16
  * Connection details of a service endpoint of an Ethereal test account
@@ -43,32 +49,48 @@ export type TransportConfig = SMTPTransportOptions | SMTPPoolOptions | SendmailT
43
49
  * @param defaults Default message fields that are merged into every message
44
50
  * @returns Mail instance wrapping the transport
45
51
  */
46
- export declare function createTransport(transporter: SMTPPoolOptions & {
52
+ export declare function createTransport(transporter: SMTPPool | (SMTPPoolOptions & {
47
53
  pool: true;
48
- }, defaults?: MailDefaults): Mail<SMTPPoolSentMessageInfo>;
49
- export declare function createTransport(transporter: SendmailTransportOptions & {
54
+ }), defaults?: MailDefaults): Mail<SMTPPoolSentMessageInfo, SMTPPoolOptions>;
55
+ export declare function createTransport(transporter: SendmailTransport | (SendmailTransportOptions & {
50
56
  sendmail: true | string;
51
- }, defaults?: MailDefaults): Mail<SendmailSentMessageInfo>;
52
- export declare function createTransport(transporter: StreamTransportOptions & {
57
+ }), defaults?: MailDefaults): Mail<SendmailSentMessageInfo, SendmailTransportOptions>;
58
+ export declare function createTransport(transporter: StreamTransport | (StreamTransportOptions & {
53
59
  streamTransport: true;
54
- }, defaults?: MailDefaults): Mail<StreamSentMessageInfo>;
60
+ }), defaults?: MailDefaults): Mail<StreamSentMessageInfo, StreamTransportOptions>;
55
61
  export declare function createTransport(transporter: JSONTransportOptions & {
56
62
  jsonTransport: true;
57
- }, defaults?: MailDefaults): Mail<JSONSentMessageInfo>;
58
- export declare function createTransport(transporter: SESTransportOptions & {
63
+ skipEncoding: true;
64
+ }, defaults?: MailDefaults): Mail<JSONSentMessageObjectInfo, JSONTransportOptions>;
65
+ export declare function createTransport(transporter: JSONTransport | (JSONTransportOptions & {
66
+ jsonTransport: true;
67
+ }), defaults?: MailDefaults): Mail<JSONSentMessageInfo, JSONTransportOptions>;
68
+ export declare function createTransport(transporter: SESTransport | (SESTransportOptions & {
59
69
  SES: object;
60
- }, defaults?: MailDefaults): Mail<SESSentMessageInfo>;
61
- export declare function createTransport<T = SentMessageInfo>(transporter: Transport<T>, defaults?: MailDefaults): Mail<T>;
62
- export declare function createTransport(transporter?: SMTPTransportOptions | string, defaults?: MailDefaults): Mail<SMTPSentMessageInfo>;
63
- export declare function createTransport(transporter?: TransportConfig | Transport<any> | string, defaults?: MailDefaults): Mail<any>;
70
+ }), defaults?: MailDefaults): Mail<SESSentMessageInfo, SESTransportOptions>;
71
+ export declare function createTransport(transporter: SMTPTransport, defaults?: MailDefaults): Mail<SMTPSentMessageInfo, SMTPTransportOptions>;
72
+ export declare function createTransport<T = SentMessageInfo, D extends TransportOptions = TransportOptions>(transporter: Transport<T, D>, defaults?: MailDefaults): Mail<T, D>;
73
+ export declare function createTransport(transporter?: SMTPTransportOptions | string, defaults?: MailDefaults): Mail<SMTPSentMessageInfo, SMTPTransportOptions>;
74
+ export declare function createTransport(transporter?: TransportConfig | Transport<any, any> | string, defaults?: MailDefaults): Mail<any, any>;
64
75
  /**
65
76
  * Creates a test account from the Ethereal service (https://ethereal.email)
66
77
  *
67
- * @param apiUrl Optional API endpoint, defaults to https://api.nodemailer.com
68
- * @param callback Callback function to run with the account object. If not set, a Promise is returned
78
+ * @param callback Callback function to run with the account object
69
79
  */
70
80
  export declare function createTestAccount(callback: TestAccountCallback): void;
81
+ /**
82
+ * Creates a test account from the Ethereal service (https://ethereal.email)
83
+ *
84
+ * @param apiUrl API endpoint, defaults to https://api.nodemailer.com
85
+ * @param callback Callback function to run with the account object
86
+ */
71
87
  export declare function createTestAccount(apiUrl: string | false | null | undefined, callback: TestAccountCallback): void;
88
+ /**
89
+ * Creates a test account from the Ethereal service (https://ethereal.email)
90
+ *
91
+ * @param [apiUrl] API endpoint, defaults to https://api.nodemailer.com
92
+ * @returns Promise that resolves with the account object
93
+ */
72
94
  export declare function createTestAccount(apiUrl?: string | false | null): Promise<TestAccount>;
73
95
  /**
74
96
  * Resolves the Ethereal web URL for a message sent through an Ethereal test account
@@ -98,5 +120,5 @@ export type { SMTPTransportOptions, SMTPSentMessageInfo };
98
120
  export type { SMTPPoolOptions, SMTPPoolSentMessageInfo };
99
121
  export type { SendmailTransportOptions, SendmailSentMessageInfo };
100
122
  export type { StreamTransportOptions, StreamSentMessageInfo };
101
- export type { JSONTransportOptions, JSONSentMessageInfo };
123
+ export type { JSONTransportOptions, JSONSentMessageInfo, JSONSentMessageObjectInfo };
102
124
  export type { SESTransportOptions, SESSentMessageInfo };
@@ -205,3 +205,4 @@ const nodemailer = {
205
205
  getTestMessageUrl
206
206
  };
207
207
  exports.default = nodemailer;
208
+ Object.defineProperty(exports, 'default', { value: exports, enumerable: false, writable: true, configurable: true });
@@ -1,3 +1,3 @@
1
1
  export declare const name = "nodemailer";
2
- export declare const version = "10.0.10";
2
+ export declare const version = "10.0.14";
3
3
  export declare const homepage = "https://nodemailer.com/";
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.homepage = exports.version = exports.name = void 0;
5
5
  exports.name = 'nodemailer';
6
- exports.version = '10.0.10';
6
+ exports.version = '10.0.14';
7
7
  exports.homepage = 'https://nodemailer.com/';
@@ -178,6 +178,7 @@ const basicToDigit = function (codePoint) {
178
178
  * @see `basicToDigit()`
179
179
  * @private
180
180
  * @param digit The numeric value of a basic code point.
181
+ * @param flag Non-zero to use the uppercase form of the code point.
181
182
  * @returns The basic code point whose value (when used for
182
183
  * representing integers) is `digit`, which needs to be in the range
183
184
  * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
@@ -15,6 +15,8 @@ export interface QPEncoderOptions {
15
15
  /** Maximum length for lines, set to false to disable wrapping */
16
16
  lineLength?: number | false | undefined;
17
17
  }
18
+ /** The name @types/nodemailer used for QPEncoderOptions */
19
+ export type EncoderOptions = QPEncoderOptions;
18
20
  /**
19
21
  * Creates a transform stream for encoding data to Quoted-Printable encoding
20
22
  *
@@ -10,6 +10,8 @@ const node_stream_1 = require("node:stream");
10
10
  * @param buffer Buffer to convert
11
11
  * @returns Quoted-Printable encoded string
12
12
  */
13
+ // the shortest line wrap() can make progress with: a complete =XX sequence and the soft break
14
+ const MIN_LINE_LENGTH = 4;
13
15
  // usable characters that do not need encoding
14
16
  // https://tools.ietf.org/html/rfc2045#section-6.7
15
17
  const QP_RANGES = [
@@ -46,7 +48,9 @@ function encode(buffer) {
46
48
  */
47
49
  function wrap(str, lineLength) {
48
50
  str = (str || '').toString();
49
- lineLength = lineLength || 76;
51
+ // a line has to hold a complete =XX sequence plus the soft break, shorter lengths
52
+ // (or a negative one) would loop without consuming input
53
+ lineLength = Math.max(Number(lineLength) || 76, MIN_LINE_LENGTH);
50
54
  if (str.length <= lineLength) {
51
55
  return str;
52
56
  }
@@ -100,6 +104,11 @@ function wrap(str, lineLength) {
100
104
  }
101
105
  }
102
106
  }
107
+ if (!line.length) {
108
+ // the trimming above emptied the line, which only happens for an incomplete
109
+ // escape at the very end of the input. Take it as is rather than loop on it
110
+ line = str.substr(pos, lineLength);
111
+ }
103
112
  if (pos + line.length < len && line.substr(-1) !== '\n') {
104
113
  if (line.length === lineLength && line.match(/[=][\da-f]{2}$/i)) {
105
114
  line = line.substr(0, line.length - 3);
@@ -64,4 +64,6 @@ declare namespace SendmailTransport {
64
64
  type MailOptions = SendMailOptions;
65
65
  type SentMessageInfo = SendmailSentMessageInfo;
66
66
  }
67
+ /** The same aliases as module level exports, for `import * as SendmailTransport` and `import SendmailTransport = require()` */
68
+ export type { SendmailTransportOptions as Options, SendMailOptions as MailOptions, SendmailSentMessageInfo as SentMessageInfo };
67
69
  export default SendmailTransport;
@@ -21,6 +21,32 @@ export interface SESTransportOptions extends TransportOptions {
21
21
  SendEmailCommand: new (input: any) => unknown;
22
22
  };
23
23
  }
24
+ /** The SESv2Client shape the transport needs */
25
+ export type SESTransportClient = SESTransportOptions['SES']['sesClient'];
26
+ /** The SendEmailCommand constructor shape the transport needs */
27
+ export type SESTransportSendEmailCommand = SESTransportOptions['SES']['SendEmailCommand'];
28
+ /**
29
+ * SendEmailCommand parameters, the shape of the `ses` message option that is merged into
30
+ * the API call. Any further SendEmailCommandInput field is accepted as well
31
+ */
32
+ export interface SESSendEmailRequest {
33
+ FromEmailAddress?: string | undefined;
34
+ Destination?: {
35
+ ToAddresses?: string[] | undefined;
36
+ CcAddresses?: string[] | undefined;
37
+ BccAddresses?: string[] | undefined;
38
+ } | undefined;
39
+ ReplyToAddresses?: string[] | undefined;
40
+ Content?: unknown;
41
+ EmailTags?: Array<{
42
+ Name?: string | undefined;
43
+ Value?: string | undefined;
44
+ }> | undefined;
45
+ ConfigurationSetName?: string | undefined;
46
+ ListManagementOptions?: unknown;
47
+ FeedbackForwardingEmailAddress?: string | undefined;
48
+ [key: string]: unknown;
49
+ }
24
50
  /**
25
51
  * The value the SES transport hands to the send callback
26
52
  */
@@ -47,7 +73,7 @@ declare class SESTransport extends EventEmitter {
47
73
  name: string;
48
74
  version: string;
49
75
  logger: Logger;
50
- constructor(options?: SESTransportOptions);
76
+ constructor(options: SESTransportOptions);
51
77
  getRegion(cb: (err: Error | null, region?: string | false) => void): void;
52
78
  /**
53
79
  * Compiles a mailcomposer message and forwards it to SES
@@ -59,9 +85,14 @@ declare class SESTransport extends EventEmitter {
59
85
  /**
60
86
  * Verifies SES configuration
61
87
  *
62
- * @param callback Callback function
88
+ * @returns Promise that resolves to true if the configuration is usable
63
89
  */
64
90
  verify(): Promise<true>;
91
+ /**
92
+ * Verifies SES configuration
93
+ *
94
+ * @param callback Callback function
95
+ */
65
96
  verify(callback: VerifyCallback): void;
66
97
  }
67
98
  /**
@@ -71,5 +102,11 @@ declare namespace SESTransport {
71
102
  type Options = SESTransportOptions;
72
103
  type MailOptions = SendMailOptions;
73
104
  type SentMessageInfo = SESSentMessageInfo;
105
+ type SESv2ClientLike = SESTransportClient;
106
+ type SendEmailCommandConstructorLike = SESTransportSendEmailCommand;
107
+ type SendEmailRequestLike = SESSendEmailRequest;
108
+ type MailSesOptions = SESSendEmailRequest;
74
109
  }
110
+ /** The same aliases as module level exports, for `import * as SESTransport` and `import SESTransport = require()` */
111
+ export type { SESTransportOptions as Options, SendMailOptions as MailOptions, SESSentMessageInfo as SentMessageInfo, SESTransportClient as SESv2ClientLike, SESTransportSendEmailCommand as SendEmailCommandConstructorLike, SESSendEmailRequest as SendEmailRequestLike, SESSendEmailRequest as MailSesOptions };
75
112
  export default SESTransport;
@@ -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(data?: LogEntry, message?: string, ...args: any[]): void;
112
- debug(data?: LogEntry, message?: string, ...args: any[]): void;
113
- info(data?: LogEntry, message?: string, ...args: any[]): void;
114
- warn(data?: LogEntry, message?: string, ...args: any[]): void;
115
- error(data?: LogEntry, message?: string, ...args: any[]): void;
116
- fatal(data?: LogEntry, message?: string, ...args: any[]): void;
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;
@@ -362,6 +362,7 @@ exports._logFunc = _logFunc;
362
362
  * creates a default console logger
363
363
  *
364
364
  * @param [options] Options object that might include 'logger' value
365
+ * @param [defaults] Fields merged into every log entry, overridden by the fields of the entry itself
365
366
  * @return bunyan compatible logger
366
367
  */
367
368
  const getLogger = (options, defaults) => {
@@ -377,8 +378,10 @@ const getLogger = (options, defaults) => {
377
378
  }
378
379
  const logger = options.logger === true ? createDefaultLogger(levels) : options.logger;
379
380
  levels.forEach(level => {
380
- response[level] = (data, message, ...args) => {
381
- (0, exports._logFunc)(logger, level, defaults, data, message, ...args);
381
+ response[level] = (...args) => {
382
+ // the bunyan forms: a data object first, or the message alone
383
+ const data = typeof args[0] === 'string' ? undefined : args.shift();
384
+ (0, exports._logFunc)(logger, level, defaults, data, ...args);
382
385
  };
383
386
  });
384
387
  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,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const node_stream_1 = require("node:stream");
4
+ // bytes inserted into the output, shared as they are only ever copied by Buffer.concat
5
+ const INSERT_LF = Buffer.from('\n');
6
+ const INSERT_LF_DOT = Buffer.from('\n.');
7
+ const INSERT_CR = Buffer.from('\r');
8
+ const INSERT_DOT = Buffer.from('.');
4
9
  /**
5
10
  * Escapes dots in the beginning of lines. Ends the stream with <CR><LF>.<CR><LF>
6
- * Also makes sure that only <CR><LF> sequences are used for linebreaks
11
+ * Also makes sure that only <CR><LF> sequences are used for linebreaks, bare CR and bare LF
12
+ * are both turned into <CR><LF>
7
13
  *
8
14
  * @param options Stream options
9
15
  */
@@ -32,33 +38,35 @@ class DataStream extends node_stream_1.Transform {
32
38
  }
33
39
  this.inByteCount += chunk.length;
34
40
  for (i = 0, len = chunk.length; i < len; i++) {
35
- if (chunk[i] === 0x2e) {
36
- // .
37
- if ((i && chunk[i - 1] === 0x0a) || (!i && (!this.lastByte || this.lastByte === 0x0a))) {
38
- buf = chunk.slice(lastPos, i + 1);
39
- chunks.push(buf);
40
- chunks.push(Buffer.from('.'));
41
- chunklen += buf.length + 1;
42
- lastPos = i + 1;
43
- }
41
+ const byte = chunk[i];
42
+ const prev = i ? chunk[i - 1] : this.lastByte;
43
+ let insert = false;
44
+ if (prev === 0x0d && byte !== 0x0a) {
45
+ // a bare CR becomes CRLF. A receiver that treats a lone CR as a line end would
46
+ // otherwise see "\r.\r" as the end of the data (SMTP smuggling), so a dot
47
+ // following it is stuffed like at the start of any other line
48
+ insert = byte === 0x2e ? INSERT_LF_DOT : INSERT_LF;
49
+ }
50
+ else if (byte === 0x0a && prev !== 0x0d) {
51
+ // a bare LF becomes CRLF
52
+ insert = INSERT_CR;
44
53
  }
45
- else if (chunk[i] === 0x0a) {
46
- // \n
47
- if ((i && chunk[i - 1] !== 0x0d) || (!i && this.lastByte !== 0x0d)) {
48
- if (i > lastPos) {
49
- buf = chunk.slice(lastPos, i);
50
- chunks.push(buf);
51
- chunklen += buf.length + 2;
52
- }
53
- else {
54
- chunklen += 2;
55
- }
56
- chunks.push(Buffer.from('\r\n'));
57
- lastPos = i + 1;
54
+ else if (byte === 0x2e && (prev === 0x0a || prev === false)) {
55
+ // a dot at the start of a line
56
+ insert = INSERT_DOT;
57
+ }
58
+ if (insert) {
59
+ if (i > lastPos) {
60
+ buf = chunk.slice(lastPos, i);
61
+ chunks.push(buf);
62
+ chunklen += buf.length;
58
63
  }
64
+ chunks.push(insert);
65
+ chunklen += insert.length;
66
+ lastPos = i;
59
67
  }
60
68
  }
61
- if (chunklen) {
69
+ if (chunks.length) {
62
70
  // add last piece
63
71
  if (lastPos < chunk.length) {
64
72
  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 { NodemailerError } from '../errors.js';
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 = (err: NodemailerError | null, socket?: net.Socket) => void;
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, etg "http://proxy.host:3128/"
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 [tlsOptions] Optional TLS options for an HTTPS proxy (e.g. { rejectUnauthorized: false })
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.
@@ -52,6 +52,8 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
52
52
  tlsOptions = {};
53
53
  }
54
54
  tlsOptions = tlsOptions || {};
55
+ // the error paths hand over the error alone
56
+ const done = callback;
55
57
  // Reject CRLF in the destination before it reaches the CONNECT request line
56
58
  // and Host header. A tainted host/port could otherwise inject additional
57
59
  // request headers into the proxy connection (HTTP request splitting).
@@ -59,7 +61,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
59
61
  if (!destinationPort || /[\r\n]/.test(destinationHost)) {
60
62
  const err = new Error('Invalid proxy destination');
61
63
  err.code = errors.EPROXY;
62
- setImmediate(() => callback(err));
64
+ setImmediate(() => done(err));
63
65
  return;
64
66
  }
65
67
  const proxy = urllib.parse(proxyUrl);
@@ -93,7 +95,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
93
95
  catch (_E) {
94
96
  // ignore
95
97
  }
96
- callback(err);
98
+ done(err);
97
99
  };
98
100
  const timeoutErr = () => {
99
101
  const err = new Error('Proxy socket timed out');
@@ -124,18 +126,28 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
124
126
  .join('\r\n') +
125
127
  // End request
126
128
  '\r\n\r\n');
127
- let headers = '';
129
+ // The response is collected as chunks and only the bytes that just arrived, together
130
+ // with the three before them, are searched for the end of the headers. Appending to a
131
+ // string and searching all of it again re-read the whole response on every chunk.
132
+ const chunks = [];
133
+ let received = 0;
134
+ let tail = '';
128
135
  const onSocketData = (chunk) => {
129
136
  let match;
130
- let remainder;
131
137
  if (finished) {
132
138
  return;
133
139
  }
134
- headers += chunk.toString('binary');
135
- if ((match = headers.match(/\r\n\r\n/))) {
140
+ const window = tail + chunk.toString('binary');
141
+ const windowEnd = window.indexOf('\r\n\r\n');
142
+ chunks.push(chunk);
143
+ received += chunk.length;
144
+ tail = window.slice(-3);
145
+ if (windowEnd >= 0) {
136
146
  socket.removeListener('data', onSocketData);
137
- remainder = headers.substr(match.index + match[0].length);
138
- headers = headers.substr(0, match.index);
147
+ const headerEnd = received - window.length + windowEnd;
148
+ const response = Buffer.concat(chunks, received).toString('binary');
149
+ const headers = response.substr(0, headerEnd);
150
+ const remainder = response.substr(headerEnd + 4);
139
151
  if (remainder) {
140
152
  socket.unshift(Buffer.from(remainder, 'binary'));
141
153
  }
@@ -152,14 +164,14 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
152
164
  }
153
165
  const err = new Error('Invalid response from proxy' + ((match && ': ' + match[1]) || ''));
154
166
  err.code = errors.EPROXY;
155
- return callback(err);
167
+ return done(err);
156
168
  }
157
169
  socket.removeListener('error', tempSocketErr);
158
170
  socket.removeListener('timeout', timeoutErr);
159
171
  socket.setTimeout(0);
160
- return callback(null, socket);
172
+ return done(null, socket);
161
173
  }
162
- if (headers.length > MAX_RESPONSE_HEADER_BYTES) {
174
+ if (received > MAX_RESPONSE_HEADER_BYTES) {
163
175
  socket.removeListener('data', onSocketData);
164
176
  const err = new Error('Proxy response headers too large');
165
177
  err.code = errors.EPROXY;