nodemailer 10.0.0 → 10.0.2

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 (100) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/addressparser/index.d.ts +1 -3
  3. package/dist/cjs/base64/index.d.ts +2 -6
  4. package/dist/cjs/base64/index.js +2 -0
  5. package/dist/cjs/dkim/index.d.ts +4 -4
  6. package/dist/cjs/dkim/message-parser.d.ts +1 -3
  7. package/dist/cjs/dkim/message-parser.js +2 -0
  8. package/dist/cjs/dkim/relaxed-body.d.ts +3 -22
  9. package/dist/cjs/dkim/relaxed-body.js +5 -0
  10. package/dist/cjs/dkim/sign.d.ts +5 -5
  11. package/dist/cjs/errors.d.ts +8 -8
  12. package/dist/cjs/fetch/cookies.d.ts +8 -8
  13. package/dist/cjs/fetch/index.d.ts +15 -15
  14. package/dist/cjs/json-transport/index.d.ts +2 -2
  15. package/dist/cjs/mail-composer/index.d.ts +49 -104
  16. package/dist/cjs/mail-composer/index.js +6 -0
  17. package/dist/cjs/mailer/index.d.ts +21 -28
  18. package/dist/cjs/mailer/index.js +19 -5
  19. package/dist/cjs/mailer/mail-message.d.ts +8 -12
  20. package/dist/cjs/mailer/mail-message.js +2 -0
  21. package/dist/cjs/mime-funcs/index.d.ts +1 -1
  22. package/dist/cjs/mime-node/index.d.ts +37 -191
  23. package/dist/cjs/mime-node/index.js +45 -7
  24. package/dist/cjs/mime-node/last-newline.d.ts +1 -3
  25. package/dist/cjs/mime-node/last-newline.js +2 -0
  26. package/dist/cjs/mime-node/le-unix.d.ts +1 -5
  27. package/dist/cjs/mime-node/le-unix.js +1 -0
  28. package/dist/cjs/mime-node/le-windows.d.ts +1 -5
  29. package/dist/cjs/mime-node/le-windows.js +1 -0
  30. package/dist/cjs/nodemailer.d.ts +2 -2
  31. package/dist/cjs/package-info.d.ts +1 -1
  32. package/dist/cjs/package-info.js +1 -1
  33. package/dist/cjs/qp/index.d.ts +2 -5
  34. package/dist/cjs/qp/index.js +2 -0
  35. package/dist/cjs/sendmail-transport/index.d.ts +4 -6
  36. package/dist/cjs/ses-transport/index.d.ts +2 -2
  37. package/dist/cjs/shared/index.d.ts +31 -37
  38. package/dist/cjs/shared/index.js +19 -7
  39. package/dist/cjs/smtp-connection/data-stream.d.ts +1 -9
  40. package/dist/cjs/smtp-connection/data-stream.js +2 -0
  41. package/dist/cjs/smtp-connection/http-proxy-client.d.ts +1 -1
  42. package/dist/cjs/smtp-connection/index.d.ts +62 -403
  43. package/dist/cjs/smtp-connection/index.js +37 -1
  44. package/dist/cjs/smtp-pool/index.d.ts +8 -46
  45. package/dist/cjs/smtp-pool/index.js +9 -0
  46. package/dist/cjs/smtp-pool/pool-resource.d.ts +2 -4
  47. package/dist/cjs/smtp-transport/index.d.ts +16 -16
  48. package/dist/cjs/stream-transport/index.d.ts +3 -3
  49. package/dist/cjs/well-known/index.d.ts +9 -9
  50. package/dist/cjs/xoauth2/index.d.ts +18 -18
  51. package/dist/esm/addressparser/index.d.ts +1 -3
  52. package/dist/esm/base64/index.d.ts +2 -6
  53. package/dist/esm/base64/index.js +2 -0
  54. package/dist/esm/dkim/index.d.ts +4 -4
  55. package/dist/esm/dkim/message-parser.d.ts +1 -3
  56. package/dist/esm/dkim/message-parser.js +2 -0
  57. package/dist/esm/dkim/relaxed-body.d.ts +3 -22
  58. package/dist/esm/dkim/relaxed-body.js +5 -0
  59. package/dist/esm/dkim/sign.d.ts +5 -5
  60. package/dist/esm/errors.d.ts +8 -8
  61. package/dist/esm/fetch/cookies.d.ts +8 -8
  62. package/dist/esm/fetch/index.d.ts +15 -15
  63. package/dist/esm/json-transport/index.d.ts +2 -2
  64. package/dist/esm/mail-composer/index.d.ts +49 -104
  65. package/dist/esm/mail-composer/index.js +6 -0
  66. package/dist/esm/mailer/index.d.ts +21 -28
  67. package/dist/esm/mailer/index.js +19 -5
  68. package/dist/esm/mailer/mail-message.d.ts +8 -12
  69. package/dist/esm/mailer/mail-message.js +2 -0
  70. package/dist/esm/mime-funcs/index.d.ts +1 -1
  71. package/dist/esm/mime-node/index.d.ts +37 -191
  72. package/dist/esm/mime-node/index.js +45 -7
  73. package/dist/esm/mime-node/last-newline.d.ts +1 -3
  74. package/dist/esm/mime-node/last-newline.js +2 -0
  75. package/dist/esm/mime-node/le-unix.d.ts +1 -5
  76. package/dist/esm/mime-node/le-unix.js +1 -0
  77. package/dist/esm/mime-node/le-windows.d.ts +1 -5
  78. package/dist/esm/mime-node/le-windows.js +1 -0
  79. package/dist/esm/nodemailer.d.ts +2 -2
  80. package/dist/esm/package-info.d.ts +1 -1
  81. package/dist/esm/package-info.js +1 -1
  82. package/dist/esm/qp/index.d.ts +2 -5
  83. package/dist/esm/qp/index.js +2 -0
  84. package/dist/esm/sendmail-transport/index.d.ts +4 -6
  85. package/dist/esm/ses-transport/index.d.ts +2 -2
  86. package/dist/esm/shared/index.d.ts +31 -37
  87. package/dist/esm/shared/index.js +19 -7
  88. package/dist/esm/smtp-connection/data-stream.d.ts +1 -9
  89. package/dist/esm/smtp-connection/data-stream.js +2 -0
  90. package/dist/esm/smtp-connection/http-proxy-client.d.ts +1 -1
  91. package/dist/esm/smtp-connection/index.d.ts +62 -403
  92. package/dist/esm/smtp-connection/index.js +37 -1
  93. package/dist/esm/smtp-pool/index.d.ts +8 -46
  94. package/dist/esm/smtp-pool/index.js +9 -0
  95. package/dist/esm/smtp-pool/pool-resource.d.ts +2 -4
  96. package/dist/esm/smtp-transport/index.d.ts +16 -16
  97. package/dist/esm/stream-transport/index.d.ts +3 -3
  98. package/dist/esm/well-known/index.d.ts +9 -9
  99. package/dist/esm/xoauth2/index.d.ts +18 -18
  100. package/package.json +1 -1
@@ -225,6 +225,7 @@ class SMTPConnection extends EventEmitter {
225
225
  *
226
226
  * @param opts Connection options (modified in place)
227
227
  * @param callback Called with resolved data on success
228
+ * @internal
228
229
  */
229
230
  _resolveAndConnect(opts, callback) {
230
231
  return shared.resolveHostname(opts, (err, resolved) => {
@@ -250,6 +251,7 @@ class SMTPConnection extends EventEmitter {
250
251
  *
251
252
  * @param opts Connection options
252
253
  * @param secure Whether to use TLS
254
+ * @internal
253
255
  */
254
256
  _connectToHost(opts, secure) {
255
257
  // If the client was closed while DNS resolution was in flight, do not open
@@ -282,6 +284,7 @@ class SMTPConnection extends EventEmitter {
282
284
  }
283
285
  /**
284
286
  * Sets up connection timeout and error handlers
287
+ * @internal
285
288
  */
286
289
  _setupConnectionHandlers() {
287
290
  this._connectionTimeout = setTimeout(() => {
@@ -294,6 +297,7 @@ class SMTPConnection extends EventEmitter {
294
297
  *
295
298
  * @param err Error object or message
296
299
  * @param code Error code
300
+ * @internal
297
301
  */
298
302
  _onConnectionError(err, code) {
299
303
  clearTimeout(this._connectionTimeout);
@@ -617,6 +621,7 @@ class SMTPConnection extends EventEmitter {
617
621
  * the server is opened
618
622
  *
619
623
  * @event
624
+ * @internal
620
625
  */
621
626
  _onConnect() {
622
627
  const socket = this._socket;
@@ -665,6 +670,7 @@ class SMTPConnection extends EventEmitter {
665
670
  *
666
671
  * @event
667
672
  * @param chunk Data chunk coming from the server
673
+ * @internal
668
674
  */
669
675
  _onData(chunk) {
670
676
  if (this._destroyed || !chunk || !chunk.length) {
@@ -698,6 +704,7 @@ class SMTPConnection extends EventEmitter {
698
704
  * @event
699
705
  * @param err Error object
700
706
  * @param type Error name
707
+ * @internal
701
708
  */
702
709
  _onError(err, type, data, command) {
703
710
  clearTimeout(this._connectionTimeout);
@@ -719,6 +726,7 @@ class SMTPConnection extends EventEmitter {
719
726
  this.emit('error', err);
720
727
  this.close();
721
728
  }
729
+ /** @internal */
722
730
  _formatError(message, type, response, command) {
723
731
  let err;
724
732
  if (/Error\]$/i.test(Object.prototype.toString.call(message))) {
@@ -747,6 +755,7 @@ class SMTPConnection extends EventEmitter {
747
755
  * 'close' listener for the socket
748
756
  *
749
757
  * @event
758
+ * @internal
750
759
  */
751
760
  _onClose() {
752
761
  let serverResponse = false;
@@ -776,6 +785,7 @@ class SMTPConnection extends EventEmitter {
776
785
  * 'end' listener for the socket
777
786
  *
778
787
  * @event
788
+ * @internal
779
789
  */
780
790
  _onEnd() {
781
791
  if (this._socket && !this._socket.destroyed) {
@@ -788,12 +798,14 @@ class SMTPConnection extends EventEmitter {
788
798
  * 'timeout' listener for the socket
789
799
  *
790
800
  * @event
801
+ * @internal
791
802
  */
792
803
  _onTimeout() {
793
804
  return this._onError(new Error('Timeout'), 'ETIMEDOUT', false, 'CONN');
794
805
  }
795
806
  /**
796
807
  * Destroys the client, emits 'end'
808
+ * @internal
797
809
  */
798
810
  _destroy() {
799
811
  if (this._destroyed) {
@@ -815,6 +827,7 @@ class SMTPConnection extends EventEmitter {
815
827
  *
816
828
  * @param callback Callback function to run when the connection
817
829
  * has been secured
830
+ * @internal
818
831
  */
819
832
  _upgradeConnection(callback) {
820
833
  // RFC 3207 section 6: the client MUST discard any knowledge obtained from
@@ -875,6 +888,7 @@ class SMTPConnection extends EventEmitter {
875
888
  }
876
889
  /**
877
890
  * Processes queued responses from the server
891
+ * @internal
878
892
  */
879
893
  _processResponse() {
880
894
  if (!this._responseQueue.length) {
@@ -914,6 +928,7 @@ class SMTPConnection extends EventEmitter {
914
928
  *
915
929
  * @param str String to be sent to the server
916
930
  * @param logStr Optional string to be used for logging instead of the actual string
931
+ * @internal
917
932
  */
918
933
  _sendCommand(str, logStr) {
919
934
  if (this._destroyed) {
@@ -939,6 +954,7 @@ class SMTPConnection extends EventEmitter {
939
954
  * {from:'...', to:['...']}
940
955
  * or
941
956
  * {from:{address:'...',name:'...'}, to:[address:'...',name:'...']}
957
+ * @internal
942
958
  */
943
959
  _setEnvelope(envelope, callback) {
944
960
  const args = [];
@@ -1035,6 +1051,7 @@ class SMTPConnection extends EventEmitter {
1035
1051
  }
1036
1052
  this._sendCommand('MAIL FROM:<' + this._envelope.from + '>' + (args.length ? ' ' + args.join(' ') : ''));
1037
1053
  }
1054
+ /** @internal */
1038
1055
  _setDsnEnvelope(params) {
1039
1056
  let ret = (params.ret || params.return || '').toString().toUpperCase() || null;
1040
1057
  if (ret) {
@@ -1077,6 +1094,7 @@ class SMTPConnection extends EventEmitter {
1077
1094
  orcpt
1078
1095
  };
1079
1096
  }
1097
+ /** @internal */
1080
1098
  _getDsnRcptToArgs() {
1081
1099
  const envelope = this._envelope;
1082
1100
  const args = [];
@@ -1092,6 +1110,7 @@ class SMTPConnection extends EventEmitter {
1092
1110
  }
1093
1111
  return args.length ? ' ' + args.join(' ') : '';
1094
1112
  }
1113
+ /** @internal */
1095
1114
  _createSendStream(callback) {
1096
1115
  const envelope = this._envelope;
1097
1116
  const dataStream = new DataStream();
@@ -1143,6 +1162,7 @@ class SMTPConnection extends EventEmitter {
1143
1162
  * SMTP session by sending EHLO command
1144
1163
  *
1145
1164
  * @param str Message from the server
1165
+ * @internal
1146
1166
  */
1147
1167
  _actionGreeting(str) {
1148
1168
  clearTimeout(this._greetingTimeout);
@@ -1164,6 +1184,7 @@ class SMTPConnection extends EventEmitter {
1164
1184
  * error, emit 'error', otherwise treat this as an EHLO response
1165
1185
  *
1166
1186
  * @param str Message from the server
1187
+ * @internal
1167
1188
  */
1168
1189
  _actionLHLO(str) {
1169
1190
  if (str.charAt(0) !== '2') {
@@ -1179,6 +1200,7 @@ class SMTPConnection extends EventEmitter {
1179
1200
  * authentication phase.
1180
1201
  *
1181
1202
  * @param str Message from the server
1203
+ * @internal
1182
1204
  */
1183
1205
  _actionEHLO(str) {
1184
1206
  let match;
@@ -1259,6 +1281,7 @@ class SMTPConnection extends EventEmitter {
1259
1281
  * error, emit 'error', otherwise move into the authentication phase.
1260
1282
  *
1261
1283
  * @param str Message from the server
1284
+ * @internal
1262
1285
  */
1263
1286
  _actionHELO(str) {
1264
1287
  if (str.charAt(0) !== '2') {
@@ -1275,6 +1298,7 @@ class SMTPConnection extends EventEmitter {
1275
1298
  * succeedes restart the EHLO
1276
1299
  *
1277
1300
  * @param str Message from the server
1301
+ * @internal
1278
1302
  */
1279
1303
  _actionSTARTTLS(str) {
1280
1304
  if (str.charAt(0) !== '2') {
@@ -1320,6 +1344,7 @@ class SMTPConnection extends EventEmitter {
1320
1344
  * hosts invalidly use a longer message than VXNlcm5hbWU6
1321
1345
  *
1322
1346
  * @param str Message from the server
1347
+ * @internal
1323
1348
  */
1324
1349
  _actionAUTH_LOGIN_USER(str, callback) {
1325
1350
  if (!/^334[ -]/.test(str)) {
@@ -1340,6 +1365,7 @@ class SMTPConnection extends EventEmitter {
1340
1365
  * base64 encoded again.
1341
1366
  *
1342
1367
  * @param str Message from the server
1368
+ * @internal
1343
1369
  */
1344
1370
  _actionAUTH_CRAM_MD5(str, callback) {
1345
1371
  const challengeMatch = str.match(/^334\s+(.+)$/);
@@ -1363,6 +1389,7 @@ class SMTPConnection extends EventEmitter {
1363
1389
  * the user can be considered logged in. Start waiting for a message to send
1364
1390
  *
1365
1391
  * @param str Message from the server
1392
+ * @internal
1366
1393
  */
1367
1394
  _actionAUTH_CRAM_MD5_PASS(str, callback) {
1368
1395
  if (!str.match(/^235\s+/)) {
@@ -1383,6 +1410,7 @@ class SMTPConnection extends EventEmitter {
1383
1410
  * response needs to be base64 encoded password.
1384
1411
  *
1385
1412
  * @param str Message from the server
1413
+ * @internal
1386
1414
  */
1387
1415
  _actionAUTH_LOGIN_PASS(str, callback) {
1388
1416
  if (!/^334[ -]/.test(str)) {
@@ -1401,6 +1429,7 @@ class SMTPConnection extends EventEmitter {
1401
1429
  * the user can be considered logged in. Start waiting for a message to send
1402
1430
  *
1403
1431
  * @param str Message from the server
1432
+ * @internal
1404
1433
  */
1405
1434
  _actionAUTHComplete(str, isRetry, callback) {
1406
1435
  if (!callback && typeof isRetry === 'function') {
@@ -1442,6 +1471,7 @@ class SMTPConnection extends EventEmitter {
1442
1471
  * Handle response for a MAIL FROM: command
1443
1472
  *
1444
1473
  * @param str Message from the server
1474
+ * @internal
1445
1475
  */
1446
1476
  _actionMAIL(str, callback) {
1447
1477
  const envelope = this._envelope;
@@ -1469,6 +1499,7 @@ class SMTPConnection extends EventEmitter {
1469
1499
  * Handle response for a RCPT TO: command
1470
1500
  *
1471
1501
  * @param str Message from the server
1502
+ * @internal
1472
1503
  */
1473
1504
  _actionRCPT(str, callback) {
1474
1505
  const envelope = this._envelope;
@@ -1515,6 +1546,7 @@ class SMTPConnection extends EventEmitter {
1515
1546
  * Handle response for a DATA command
1516
1547
  *
1517
1548
  * @param str Message from the server
1549
+ * @internal
1518
1550
  */
1519
1551
  _actionDATA(str, callback) {
1520
1552
  const envelope = this._envelope;
@@ -1540,6 +1572,7 @@ class SMTPConnection extends EventEmitter {
1540
1572
  * We expect a single response that defines if the sending succeeded or failed
1541
1573
  *
1542
1574
  * @param str Message from the server
1575
+ * @internal
1543
1576
  */
1544
1577
  _actionSMTPStream(str, callback) {
1545
1578
  if (Number(str.charAt(0)) !== 2) {
@@ -1555,6 +1588,7 @@ class SMTPConnection extends EventEmitter {
1555
1588
  * @param recipient The recipient this response applies to
1556
1589
  * @param final Is this the final recipient?
1557
1590
  * @param str Message from the server
1591
+ * @internal
1558
1592
  */
1559
1593
  _actionLMTPStream(recipient, final, str, callback) {
1560
1594
  const envelope = this._envelope;
@@ -1575,6 +1609,7 @@ class SMTPConnection extends EventEmitter {
1575
1609
  return callback(null, str);
1576
1610
  }
1577
1611
  }
1612
+ /** @internal */
1578
1613
  _handleXOauth2Token(isRetry, callback) {
1579
1614
  this._auth.oauth2.getToken(isRetry, (err, accessToken) => {
1580
1615
  if (err) {
@@ -1597,7 +1632,7 @@ class SMTPConnection extends EventEmitter {
1597
1632
  /**
1598
1633
  *
1599
1634
  * @param command
1600
- * @private
1635
+ * @internal
1601
1636
  */
1602
1637
  _isDestroyedMessage(command) {
1603
1638
  if (this._destroyed) {
@@ -1612,6 +1647,7 @@ class SMTPConnection extends EventEmitter {
1612
1647
  }
1613
1648
  }
1614
1649
  }
1650
+ /** @internal */
1615
1651
  _getHostname() {
1616
1652
  // defaul hostname is machine hostname or [IP]
1617
1653
  let defaultHostname;
@@ -1,5 +1,4 @@
1
1
  import { EventEmitter } from 'node:events';
2
- import PoolResource from './pool-resource.js';
3
2
  import * as shared from '../shared/index.js';
4
3
  import type { SMTPTransportOptions, SMTPTransportGetSocketCallback, SMTPTransportSendCallback, SMTPSentMessageInfo } from '../smtp-transport/index.js';
5
4
  import type MailMessage from '../mailer/mail-message.js';
@@ -9,17 +8,17 @@ import type { default as Mail, SendMailOptions, VerifyCallback } from '../mailer
9
8
  */
10
9
  export interface SMTPPoolOptions extends SMTPTransportOptions {
11
10
  /** Set to true to get this pooled transport from createTransport */
12
- pool?: boolean;
11
+ pool?: boolean | undefined;
13
12
  /** Maximum number of open connections, defaults to 5 */
14
- maxConnections?: number;
13
+ maxConnections?: number | undefined;
15
14
  /** Number of messages a connection sends before it is closed and replaced, defaults to 100 */
16
- maxMessages?: number;
15
+ maxMessages?: number | undefined;
17
16
  /** Maximum number of messages to send in rateDelta milliseconds, unlimited when not set */
18
- rateLimit?: number;
17
+ rateLimit?: number | undefined;
19
18
  /** Time window for rateLimit in milliseconds, defaults to 1000 */
20
- rateDelta?: number;
19
+ rateDelta?: number | undefined;
21
20
  /** How many times a message is requeued when its connection closes while sending, unlimited when not set or negative */
22
- maxRequeues?: number;
21
+ maxRequeues?: number | undefined;
23
22
  }
24
23
  /**
25
24
  * The pool options once the constructor has applied the defaults
@@ -47,7 +46,7 @@ export interface SMTPPoolQueueEntry {
47
46
  /** Callback to run once the message is sent or failed */
48
47
  callback: SMTPPoolSendCallback;
49
48
  /** Message-ID value without the angle brackets, set when the entry is assigned to a connection */
50
- messageId?: string;
49
+ messageId?: string | undefined;
51
50
  }
52
51
  /**
53
52
  * Rate limiter state of the pool
@@ -77,16 +76,11 @@ declare class SMTPPool extends EventEmitter {
77
76
  logger: shared.Logger;
78
77
  name: string;
79
78
  version: string;
80
- _rateLimit: SMTPPoolRateLimit;
81
- _closed: boolean;
82
- _queue: SMTPPoolQueueEntry[];
83
- _connections: PoolResource[];
84
- _connectionCounter: number;
85
79
  idling: boolean;
86
80
  /**
87
81
  * The Mail instance using this transport, assigned by Mail
88
82
  */
89
- mailer?: Mail<SMTPPoolSentMessageInfo>;
83
+ mailer?: Mail<SMTPPoolSentMessageInfo> | undefined;
90
84
  constructor(options?: SMTPPoolOptions | string);
91
85
  /**
92
86
  * Placeholder function for creating proxy sockets. This method immediatelly returns
@@ -108,38 +102,6 @@ declare class SMTPPool extends EventEmitter {
108
102
  * is closed later
109
103
  */
110
104
  close(): void;
111
- /**
112
- * Check the queue and available connections. If there is a message to be sent and there is
113
- * an available connection, then use this connection to send the mail
114
- */
115
- _processMessages(): void;
116
- /**
117
- * Creates a new pool resource
118
- */
119
- _createConnection(): PoolResource;
120
- _shouldRequeuOnConnectionClose(queueEntry: SMTPPoolQueueEntry): boolean;
121
- _failDeliveryOnConnectionClose(connection: PoolResource): void;
122
- _requeueEntryOnConnectionClose(connection: PoolResource): void;
123
- /**
124
- * Continue to process message if the pool hasn't closed
125
- */
126
- _continueProcessing(): void;
127
- /**
128
- * Remove resource from pool
129
- *
130
- * @param connection The PoolResource to remove
131
- */
132
- _removeConnection(connection: PoolResource): void;
133
- /**
134
- * Checks if connections have hit current rate limit and if so, queues the availability callback
135
- *
136
- * @param callback Callback function to run once rate limiter has been cleared
137
- */
138
- _checkRateLimit(callback: () => void): void;
139
- /**
140
- * Clears current rate limit limitation and runs paused callback
141
- */
142
- _clearRateLimit(): void;
143
105
  /**
144
106
  * Returns true if there are free slots in the queue
145
107
  */
@@ -153,6 +153,7 @@ class SMTPPool extends EventEmitter {
153
153
  /**
154
154
  * Check the queue and available connections. If there is a message to be sent and there is
155
155
  * an available connection, then use this connection to send the mail
156
+ * @internal
156
157
  */
157
158
  _processMessages() {
158
159
  // do nothing if already closed
@@ -217,6 +218,7 @@ class SMTPPool extends EventEmitter {
217
218
  }
218
219
  /**
219
220
  * Creates a new pool resource
221
+ * @internal
220
222
  */
221
223
  _createConnection() {
222
224
  const connection = new PoolResource(this);
@@ -309,12 +311,14 @@ class SMTPPool extends EventEmitter {
309
311
  this._connections.push(connection);
310
312
  return connection;
311
313
  }
314
+ /** @internal */
312
315
  _shouldRequeuOnConnectionClose(queueEntry) {
313
316
  if (this.options.maxRequeues === undefined || this.options.maxRequeues < 0) {
314
317
  return true;
315
318
  }
316
319
  return queueEntry.requeueAttempts < this.options.maxRequeues;
317
320
  }
321
+ /** @internal */
318
322
  _failDeliveryOnConnectionClose(connection) {
319
323
  if (connection.queueEntry && connection.queueEntry.callback) {
320
324
  try {
@@ -331,6 +335,7 @@ class SMTPPool extends EventEmitter {
331
335
  connection.queueEntry = false;
332
336
  }
333
337
  }
338
+ /** @internal */
334
339
  _requeueEntryOnConnectionClose(connection) {
335
340
  connection.queueEntry.requeueAttempts += 1;
336
341
  this.logger.debug({
@@ -344,6 +349,7 @@ class SMTPPool extends EventEmitter {
344
349
  }
345
350
  /**
346
351
  * Continue to process message if the pool hasn't closed
352
+ * @internal
347
353
  */
348
354
  _continueProcessing() {
349
355
  if (this._closed) {
@@ -357,6 +363,7 @@ class SMTPPool extends EventEmitter {
357
363
  * Remove resource from pool
358
364
  *
359
365
  * @param connection The PoolResource to remove
366
+ * @internal
360
367
  */
361
368
  _removeConnection(connection) {
362
369
  const index = this._connections.indexOf(connection);
@@ -368,6 +375,7 @@ class SMTPPool extends EventEmitter {
368
375
  * Checks if connections have hit current rate limit and if so, queues the availability callback
369
376
  *
370
377
  * @param callback Callback function to run once rate limiter has been cleared
378
+ * @internal
371
379
  */
372
380
  _checkRateLimit(callback) {
373
381
  if (!this._rateLimit.limit) {
@@ -388,6 +396,7 @@ class SMTPPool extends EventEmitter {
388
396
  }
389
397
  /**
390
398
  * Clears current rate limit limitation and runs paused callback
399
+ * @internal
391
400
  */
392
401
  _clearRateLimit() {
393
402
  clearTimeout(this._rateLimit.timeout);
@@ -26,9 +26,7 @@ export default class PoolResource extends EventEmitter {
26
26
  /**
27
27
  * Authentication data for the connection, set when the pool options include auth
28
28
  */
29
- auth?: SMTPTransportAuth;
30
- _connection: boolean;
31
- _connected: boolean;
29
+ auth?: SMTPTransportAuth | undefined;
32
30
  messages: number;
33
31
  available: boolean;
34
32
  /**
@@ -42,7 +40,7 @@ export default class PoolResource extends EventEmitter {
42
40
  /**
43
41
  * The queue entry being sent, assigned by the pool. False once it has been handled
44
42
  */
45
- queueEntry?: SMTPPoolQueueEntry | false;
43
+ queueEntry?: SMTPPoolQueueEntry | false | undefined;
46
44
  constructor(pool: SMTPPool);
47
45
  /**
48
46
  * Initiates a connection to the SMTP server
@@ -12,19 +12,19 @@ import type { MimeNodeEnvelope } from '../mime-node/index.js';
12
12
  */
13
13
  export interface SMTPTransportAuthOptions extends XOAuth2Options {
14
14
  /** 'OAuth2' selects XOAUTH2, anything else is a password login, 'LOGIN' when not set */
15
- type?: string;
15
+ type?: string | undefined;
16
16
  /** Username */
17
- user?: string;
17
+ user?: string | undefined;
18
18
  /** Password */
19
- pass?: string;
19
+ pass?: string | undefined;
20
20
  /** SASL method to use, e.g. 'PLAIN', 'LOGIN' or 'CRAM-MD5' */
21
- method?: string;
21
+ method?: string | undefined;
22
22
  /** Extra options for the authentication method, handed to a custom SASL handler */
23
23
  options?: {
24
24
  [key: string]: any;
25
- };
25
+ } | undefined;
26
26
  /** Service identifier, an OAuth2 login needs either this or a user */
27
- service?: string;
27
+ service?: string | undefined;
28
28
  }
29
29
  /**
30
30
  * Authentication data built by getAuth() and handed to SMTPConnection#login
@@ -50,21 +50,21 @@ export type SMTPTransportGetSocket = (options: SMTPTransportOptions, callback: S
50
50
  */
51
51
  export interface SMTPTransportOptions extends SMTPConnectionOptions, TransportOptions {
52
52
  /** Well-known service name, e.g. 'Gmail', fills in host, port and secure */
53
- service?: string;
53
+ service?: string | undefined;
54
54
  /** Connection url, e.g. 'smtps://user:pass@smtp.example.com', parsed into options */
55
- url?: string;
55
+ url?: string | undefined;
56
56
  /** Authentication settings, no authentication when not set */
57
- auth?: SMTPTransportAuthOptions;
57
+ auth?: SMTPTransportAuthOptions | undefined;
58
58
  /** Custom socket provider, e.g. for connecting through a proxy, replaces the getSocket method */
59
- getSocket?: SMTPTransportGetSocket;
59
+ getSocket?: SMTPTransportGetSocket | undefined;
60
60
  /** Authenticate even when the server does not advertise AUTH, and fail verify() when it does but no credentials were given */
61
- forceAuth?: boolean;
61
+ forceAuth?: boolean | undefined;
62
62
  /** Default SASL method for the password logins when the auth settings do not name one */
63
- authMethod?: string;
63
+ authMethod?: string | undefined;
64
64
  /** Logger component name, defaults to 'smtp-transport' */
65
- component?: string;
65
+ component?: string | undefined;
66
66
  /** Set to true to get a pooled transport from createTransport, this transport does not read it */
67
- pool?: boolean;
67
+ pool?: boolean | undefined;
68
68
  }
69
69
  /**
70
70
  * Result of a sent message, the connection result plus the envelope and the Message-ID
@@ -97,11 +97,11 @@ declare class SMTPTransport extends EventEmitter {
97
97
  /**
98
98
  * Transport level authentication data, set when the options include auth
99
99
  */
100
- auth?: SMTPTransportAuth | false;
100
+ auth?: SMTPTransportAuth | false | undefined;
101
101
  /**
102
102
  * The Mail instance using this transport, assigned by Mail
103
103
  */
104
- mailer?: Mail<SMTPSentMessageInfo>;
104
+ mailer?: Mail<SMTPSentMessageInfo> | undefined;
105
105
  constructor(options?: SMTPTransportOptions | string);
106
106
  /**
107
107
  * Placeholder function for creating proxy sockets. This method immediatelly returns
@@ -8,11 +8,11 @@ import type { default as Mail, SentMessageInfo, SendMailOptions, TransportOption
8
8
  */
9
9
  export interface StreamTransportOptions extends TransportOptions {
10
10
  /** Selects this transport in createTransport */
11
- streamTransport?: boolean;
11
+ streamTransport?: boolean | undefined;
12
12
  /** If true, the message is returned as a Buffer object instead of a stream */
13
- buffer?: boolean;
13
+ buffer?: boolean | undefined;
14
14
  /** Either 'windows' or 'unix', the line ending of the generated message */
15
- newline?: string;
15
+ newline?: string | undefined;
16
16
  }
17
17
  /**
18
18
  * The value the Stream transport hands to the send callback
@@ -3,23 +3,23 @@
3
3
  */
4
4
  export interface WellKnownServiceDefinition {
5
5
  /** Human readable description of the service */
6
- description?: string;
6
+ description?: string | undefined;
7
7
  /** Domains of e-mail addresses hosted by the service */
8
- domains?: string[];
8
+ domains?: string[] | undefined;
9
9
  /** Alternative names the service can be looked up by */
10
- aliases?: string[];
10
+ aliases?: string[] | undefined;
11
11
  /** SMTP hostname */
12
- host?: string;
12
+ host?: string | undefined;
13
13
  /** SMTP port (a numeric string in a few entries) */
14
- port?: number | string;
14
+ port?: number | string | undefined;
15
15
  /** true for implicit TLS (usually port 465) */
16
- secure?: boolean;
16
+ secure?: boolean | undefined;
17
17
  /** Preferred authentication method */
18
- authMethod?: string;
18
+ authMethod?: string | undefined;
19
19
  /** Set to true to require STARTTLS on a plaintext connection */
20
- requireTLS?: boolean;
20
+ requireTLS?: boolean | undefined;
21
21
  /** Set to true to skip STARTTLS */
22
- ignoreTLS?: boolean;
22
+ ignoreTLS?: boolean | undefined;
23
23
  }
24
24
  /**
25
25
  * SMTP settings of a well-known service, without the lookup keys
@@ -25,50 +25,50 @@ export type XOAuth2PrivateKey = crypto.KeyLike | crypto.SignKeyObjectInput | cry
25
25
  */
26
26
  export interface XOAuth2Options {
27
27
  /** User e-mail address */
28
- user?: string;
28
+ user?: string | undefined;
29
29
  /** Client ID value */
30
- clientId?: string;
30
+ clientId?: string | undefined;
31
31
  /** Client secret value */
32
- clientSecret?: string;
32
+ clientSecret?: string | undefined;
33
33
  /** Refresh token for an user */
34
- refreshToken?: string;
34
+ refreshToken?: string | undefined;
35
35
  /** Endpoint for token generation, defaults to 'https://accounts.google.com/o/oauth2/token' */
36
- accessUrl?: string;
36
+ accessUrl?: string | undefined;
37
37
  /** An existing valid accessToken */
38
- accessToken?: string;
38
+ accessToken?: string | undefined;
39
39
  /** Private key for JSW */
40
- privateKey?: XOAuth2PrivateKey;
40
+ privateKey?: XOAuth2PrivateKey | undefined;
41
41
  /** Optional Access Token expire time in ms */
42
- expires?: number;
42
+ expires?: number | undefined;
43
43
  /** Optional TTL for Access Token in seconds */
44
- timeout?: number;
44
+ timeout?: number | undefined;
45
45
  /** Function to run when a new access token is required */
46
- provisionCallback?: XOAuth2ProvisionCallback;
46
+ provisionCallback?: XOAuth2ProvisionCallback | undefined;
47
47
  /** Optional TLS options forwarded to the HTTPS token request. Defaults to strict cert validation; supply { rejectUnauthorized: false } only for self-hosted OAuth providers on private CAs. */
48
48
  tls?: {
49
49
  [key: string]: any;
50
- };
50
+ } | undefined;
51
51
  /** Service account client id (the JWT issuer), switches to the JWT bearer flow */
52
- serviceClient?: string;
52
+ serviceClient?: string | undefined;
53
53
  /** Lifetime of the service account JWT in seconds, defaults to 5 minutes, capped at an hour */
54
- serviceRequestTimeout?: number;
54
+ serviceRequestTimeout?: number | undefined;
55
55
  /** OAuth2 scope for the service account flow, defaults to 'https://mail.google.com/' */
56
- scope?: string;
56
+ scope?: string | undefined;
57
57
  /** Logger component name, defaults to 'OAuth2' */
58
- component?: string;
58
+ component?: string | undefined;
59
59
  /** Extra headers for the token request */
60
- customHeaders?: OutgoingHttpHeaders;
60
+ customHeaders?: OutgoingHttpHeaders | undefined;
61
61
  /** Extra form fields for the token request */
62
62
  customParams?: {
63
63
  [key: string]: any;
64
- };
64
+ } | undefined;
65
65
  }
66
66
  /**
67
67
  * The object emitted with the 'token' event once a new access token has been generated
68
68
  */
69
69
  export interface XOAuth2Token {
70
70
  /** User e-mail address */
71
- user?: string;
71
+ user?: string | undefined;
72
72
  /** The new access token */
73
73
  accessToken: string;
74
74
  /** Expire time as a timestamp in milliseconds, 0 when unknown */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodemailer",
3
- "version": "10.0.0",
3
+ "version": "10.0.2",
4
4
  "description": "Easy as cake e-mail sending from your Node.js applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/nodemailer.js",