nodemailer 10.0.13 → 10.0.15
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/CHANGELOG.md +20 -0
- package/dist/cjs/addressparser/index.d.ts +0 -1
- package/dist/cjs/addressparser/index.js +55 -17
- package/dist/cjs/dkim/message-parser.js +28 -4
- package/dist/cjs/dkim/sign.d.ts +1 -0
- package/dist/cjs/dkim/sign.js +1 -0
- package/dist/cjs/errors.d.ts +3 -3
- package/dist/cjs/mailer/index.d.ts +7 -1
- package/dist/cjs/mime-funcs/index.d.ts +2 -1
- package/dist/cjs/mime-funcs/index.js +197 -83
- package/dist/cjs/mime-node/index.js +2 -1
- package/dist/cjs/nodemailer.d.ts +13 -2
- package/dist/cjs/package-info.d.ts +1 -1
- package/dist/cjs/package-info.js +1 -1
- package/dist/cjs/punycode/index.js +1 -0
- package/dist/cjs/ses-transport/index.d.ts +6 -1
- package/dist/cjs/shared/index.d.ts +25 -1
- package/dist/cjs/shared/index.js +1 -0
- package/dist/cjs/smtp-connection/http-proxy-client.d.ts +11 -3
- package/dist/cjs/smtp-connection/http-proxy-client.js +17 -7
- package/dist/cjs/smtp-connection/index.d.ts +1 -1
- package/dist/cjs/smtp-connection/index.js +15 -1
- package/dist/cjs/smtp-pool/index.d.ts +6 -1
- package/dist/cjs/smtp-transport/index.d.ts +6 -1
- package/dist/cjs/well-known/services.js +6 -0
- package/dist/esm/addressparser/index.d.ts +0 -1
- package/dist/esm/addressparser/index.js +55 -17
- package/dist/esm/dkim/message-parser.js +28 -4
- package/dist/esm/dkim/sign.d.ts +1 -0
- package/dist/esm/dkim/sign.js +1 -0
- package/dist/esm/errors.d.ts +3 -3
- package/dist/esm/mailer/index.d.ts +7 -1
- package/dist/esm/mime-funcs/index.d.ts +2 -1
- package/dist/esm/mime-funcs/index.js +197 -83
- package/dist/esm/mime-node/index.js +2 -1
- package/dist/esm/nodemailer.d.ts +13 -2
- package/dist/esm/package-info.d.ts +1 -1
- package/dist/esm/package-info.js +1 -1
- package/dist/esm/punycode/index.js +1 -0
- package/dist/esm/ses-transport/index.d.ts +6 -1
- package/dist/esm/shared/index.d.ts +25 -1
- package/dist/esm/shared/index.js +1 -0
- package/dist/esm/smtp-connection/http-proxy-client.d.ts +11 -3
- package/dist/esm/smtp-connection/http-proxy-client.js +17 -7
- package/dist/esm/smtp-connection/index.d.ts +1 -1
- package/dist/esm/smtp-connection/index.js +15 -1
- package/dist/esm/smtp-pool/index.d.ts +6 -1
- package/dist/esm/smtp-transport/index.d.ts +6 -1
- package/dist/esm/well-known/services.js +6 -0
- package/dist/well-known/services.json +7 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## [10.0.15](https://github.com/nodemailer/nodemailer/compare/v10.0.14...v10.0.15) (2026-10-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **errors:** inherit NodemailerError code from ErrnoException ([e99db61](https://github.com/nodemailer/nodemailer/commit/e99db61d51c244e184a3a79103d1d732ffb6376b)), closes [#1884](https://github.com/nodemailer/nodemailer/issues/1884)
|
|
9
|
+
* **errors:** keep NodemailerError compatible with @types/node 26 ErrnoException ([#1885](https://github.com/nodemailer/nodemailer/issues/1885)) ([b660328](https://github.com/nodemailer/nodemailer/commit/b6603286cc45bff52c13cc74e5ac47f424452fdc))
|
|
10
|
+
|
|
11
|
+
## [10.0.14](https://github.com/nodemailer/nodemailer/compare/v10.0.13...v10.0.14) (2026-10-03)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **addressparser:** keep a quoted display name that holds no "@" out of the address ([3570d26](https://github.com/nodemailer/nodemailer/commit/3570d26c7b55f6e5df50d4076046600ad3fd040b))
|
|
17
|
+
* **addressparser:** keep the group recursion depth out of the options object ([a680254](https://github.com/nodemailer/nodemailer/commit/a68025405a1378c82e78f64ffad27b92c1035cbe))
|
|
18
|
+
* **addressparser:** stop a "[" from hiding the operators after it ([5619784](https://github.com/nodemailer/nodemailer/commit/561978491d5cc33d2052a6c89a499b838b960262))
|
|
19
|
+
* **dkim:** trim a header field name in linear time ([c6f7a55](https://github.com/nodemailer/nodemailer/commit/c6f7a55a2978bf031b8519ebf59baddf94c032c8))
|
|
20
|
+
* **mime-funcs:** read and write header parameters per rfc2045 and rfc2231 ([b8ccad7](https://github.com/nodemailer/nodemailer/commit/b8ccad723a7e49a674a4d70f32eb9fe77312008d))
|
|
21
|
+
* search only the new bytes for the end of the proxy CONNECT response ([81efd7b](https://github.com/nodemailer/nodemailer/commit/81efd7bfc559305f900d6a22b5c56aa94556002b))
|
|
22
|
+
|
|
3
23
|
## [10.0.13](https://github.com/nodemailer/nodemailer/compare/v10.0.12...v10.0.13) (2026-09-30)
|
|
4
24
|
|
|
5
25
|
|
|
@@ -39,7 +39,6 @@ export type Address = MailboxAddress | GroupAddress;
|
|
|
39
39
|
*
|
|
40
40
|
* @param str Address field
|
|
41
41
|
* @param options Optional options object
|
|
42
|
-
* @param options._depth Internal recursion depth counter (do not set manually)
|
|
43
42
|
* @return An array of address objects
|
|
44
43
|
*/
|
|
45
44
|
declare function addressparser(str: string | null | undefined, options: AddressParserOptions & {
|
|
@@ -428,7 +428,7 @@ function _handleAddress(tokens, depth) {
|
|
|
428
428
|
// Parse group members, but flatten any nested groups (RFC 5322 doesn't allow nesting)
|
|
429
429
|
let groupMembers = [];
|
|
430
430
|
if (data.group.length) {
|
|
431
|
-
const parsedGroup =
|
|
431
|
+
const parsedGroup = _parseAddressList(data.group.join(','), depth + 1);
|
|
432
432
|
parsedGroup.forEach(member => {
|
|
433
433
|
if (member.group) {
|
|
434
434
|
groupMembers = groupMembers.concat(member.group);
|
|
@@ -515,7 +515,13 @@ function _handleAddress(tokens, depth) {
|
|
|
515
515
|
// Join values with spaces
|
|
516
516
|
data.text = data.text.join(' ');
|
|
517
517
|
data.address = data.address.join(' ');
|
|
518
|
-
if (addressFromQuotedText && data.text) {
|
|
518
|
+
if (addressFromQuotedText && data.text.indexOf('@') >= 0) {
|
|
519
|
+
// A quoted run with no '@' in it is a display name and nothing else, so it stays
|
|
520
|
+
// where it is. Moving it over anyway made a comment the mailbox was read from:
|
|
521
|
+
// '"Display Name" <(a comment)>' handed on 'Display Name' as the address with the
|
|
522
|
+
// comment as the name, and a quoted name holding a ',' or a ';' became an address
|
|
523
|
+
// that reads as two recipients once a consumer writes it back into a header.
|
|
524
|
+
//
|
|
519
525
|
// The mailbox is still sitting in the text, so it moves over here and is quoted
|
|
520
526
|
// before the recovery below rather than after it. Anything else the text holds
|
|
521
527
|
// came along with it: a comment ends the domain but leaves the atoms behind it in
|
|
@@ -562,6 +568,7 @@ class Tokenizer {
|
|
|
562
568
|
this.node = null;
|
|
563
569
|
this.escaped = false;
|
|
564
570
|
this.inDomainLiteral = false;
|
|
571
|
+
this.afterAt = false;
|
|
565
572
|
this.list = [];
|
|
566
573
|
/**
|
|
567
574
|
* Operator tokens and which tokens are expected to end the sequence
|
|
@@ -605,17 +612,23 @@ class Tokenizer {
|
|
|
605
612
|
* Checks if a character is an operator or text and acts accordingly
|
|
606
613
|
*
|
|
607
614
|
* @param chr Character from the address field
|
|
615
|
+
* @param nextChr Character following chr, null at the end of the field
|
|
608
616
|
*/
|
|
609
617
|
checkChar(chr, nextChr) {
|
|
610
|
-
// Track RFC 5322 domain-literals ("[" *dtext "]").
|
|
611
|
-
//
|
|
612
|
-
//
|
|
613
|
-
//
|
|
614
|
-
//
|
|
615
|
-
//
|
|
616
|
-
//
|
|
618
|
+
// Track RFC 5322 domain-literals ("[" *dtext "]"). The ":" of an IPv6
|
|
619
|
+
// address-literal (user@[IPv6:2001:db8::1]) is dtext and must not be treated as
|
|
620
|
+
// the group delimiter while inside the brackets. That is the only operator the
|
|
621
|
+
// literal hides: letting it hide the others as well meant a "[" could turn the
|
|
622
|
+
// comment, quoted string or angle-addr after it into text and pick a different
|
|
623
|
+
// mailbox, '[ ( ] <a@victim.com> ) <b@evil.com>' yielded a@victim.com where
|
|
624
|
+
// RFC 5322 reads b@evil.com. A "[" also only opens a literal right after the "@"
|
|
625
|
+
// of an addr-spec, so the group delimiter of a display name holding one stays
|
|
626
|
+
// intact. Quoted strings and comments are handled separately via
|
|
627
|
+
// operatorExpecting, so only enter this state when no operator is open. The list
|
|
628
|
+
// separators "," and ";" always end the literal (and split the address list) so
|
|
629
|
+
// that an unclosed "[" cannot swallow later recipients.
|
|
617
630
|
if (!this.escaped && !this.operatorExpecting) {
|
|
618
|
-
if (!this.inDomainLiteral && chr === '[') {
|
|
631
|
+
if (!this.inDomainLiteral && chr === '[' && this.afterAt) {
|
|
619
632
|
this.inDomainLiteral = true;
|
|
620
633
|
}
|
|
621
634
|
else if (this.inDomainLiteral && (chr === ']' || chr === ',' || chr === ';')) {
|
|
@@ -635,17 +648,24 @@ class Tokenizer {
|
|
|
635
648
|
}
|
|
636
649
|
this.list.push(this.node);
|
|
637
650
|
this.node = null;
|
|
651
|
+
if (chr !== ')') {
|
|
652
|
+
// a comment is folding whitespace, it does not part the "@" from the "["
|
|
653
|
+
this.afterAt = false;
|
|
654
|
+
}
|
|
638
655
|
this.operatorExpecting = '';
|
|
639
656
|
this.escaped = false;
|
|
640
657
|
return;
|
|
641
658
|
}
|
|
642
|
-
else if (!this.operatorExpecting && !this.inDomainLiteral && chr in this.operators) {
|
|
659
|
+
else if (!this.operatorExpecting && !(this.inDomainLiteral && chr === ':') && chr in this.operators) {
|
|
643
660
|
this.node = {
|
|
644
661
|
type: 'operator',
|
|
645
662
|
value: chr
|
|
646
663
|
};
|
|
647
664
|
this.list.push(this.node);
|
|
648
665
|
this.node = null;
|
|
666
|
+
if (chr !== '(') {
|
|
667
|
+
this.afterAt = false;
|
|
668
|
+
}
|
|
649
669
|
this.operatorExpecting = this.operators[chr];
|
|
650
670
|
this.escaped = false;
|
|
651
671
|
return;
|
|
@@ -669,6 +689,11 @@ class Tokenizer {
|
|
|
669
689
|
if (chr.charCodeAt(0) >= 0x21 || [' ', '\t'].includes(chr)) {
|
|
670
690
|
// skip command bytes
|
|
671
691
|
this.node.value += chr;
|
|
692
|
+
// text inside a quoted string or a comment is not part of an addr-spec. Tracked
|
|
693
|
+
// as it goes rather than read back off the value (see lastChars in _handleAddress)
|
|
694
|
+
if (!this.operatorExpecting && chr !== ' ' && chr !== '\t') {
|
|
695
|
+
this.afterAt = chr === '@';
|
|
696
|
+
}
|
|
672
697
|
}
|
|
673
698
|
this.escaped = false;
|
|
674
699
|
}
|
|
@@ -679,9 +704,19 @@ class Tokenizer {
|
|
|
679
704
|
* malicious input that could cause stack overflow.
|
|
680
705
|
*/
|
|
681
706
|
const MAX_NESTED_GROUP_DEPTH = 50;
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
707
|
+
/**
|
|
708
|
+
* Parses an address list, recursing into the groups it holds.
|
|
709
|
+
*
|
|
710
|
+
* The depth is threaded through the calls rather than carried in an options object, so a
|
|
711
|
+
* caller supplied one can not seed it and lift the recursion limit: `{ _depth: -1e9 }`
|
|
712
|
+
* bought a billion levels of nesting and turned the guard below into the stack overflow it
|
|
713
|
+
* is there to prevent.
|
|
714
|
+
*
|
|
715
|
+
* @param str Address field
|
|
716
|
+
* @param depth Current recursion depth for nested group protection
|
|
717
|
+
* @return An array of address objects
|
|
718
|
+
*/
|
|
719
|
+
function _parseAddressList(str, depth) {
|
|
685
720
|
// Prevent stack overflow from deeply nested groups (DoS protection)
|
|
686
721
|
if (depth > MAX_NESTED_GROUP_DEPTH) {
|
|
687
722
|
return [];
|
|
@@ -690,7 +725,7 @@ function addressparser(str, options) {
|
|
|
690
725
|
const tokens = tokenizer.tokenize();
|
|
691
726
|
const addresses = [];
|
|
692
727
|
let address = [];
|
|
693
|
-
|
|
728
|
+
const parsedAddresses = [];
|
|
694
729
|
tokens.forEach(token => {
|
|
695
730
|
if (token.type === 'operator' && (token.value === ',' || token.value === ';')) {
|
|
696
731
|
if (address.length) {
|
|
@@ -731,8 +766,11 @@ function addressparser(str, options) {
|
|
|
731
766
|
}
|
|
732
767
|
}
|
|
733
768
|
mergedAddresses.reverse();
|
|
734
|
-
|
|
735
|
-
|
|
769
|
+
return mergedAddresses;
|
|
770
|
+
}
|
|
771
|
+
function addressparser(str, options) {
|
|
772
|
+
const parsedAddresses = _parseAddressList(str, 0);
|
|
773
|
+
if (options?.flatten) {
|
|
736
774
|
const flatAddresses = [];
|
|
737
775
|
const walkAddressList = (list) => {
|
|
738
776
|
list.forEach(entry => {
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_stream_1 = require("node:stream");
|
|
4
|
+
/**
|
|
5
|
+
* Drops the SP and HTAB from both ends of a field name.
|
|
6
|
+
*
|
|
7
|
+
* An index scan rather than `/^[ \t]+|[ \t]+$/g`, which retries the trailing branch at
|
|
8
|
+
* every offset of a blank run that is followed by other text: the run is consumed greedily,
|
|
9
|
+
* `$` fails, and the engine gives the characters back one at a time before moving on to
|
|
10
|
+
* start the same walk one offset further in. A field name carrying a 128 KiB run of spaces
|
|
11
|
+
* between two atoms took about 6.7 seconds to trim, and the cost grows with its square.
|
|
12
|
+
*
|
|
13
|
+
* Not `.trim()`, which takes the other Unicode spaces along: an NBSP in front of a field
|
|
14
|
+
* name would come off and select the name into the signed set, where the relaxed
|
|
15
|
+
* canonicalization in sign.ts deliberately leaves everything but SP and HTAB alone.
|
|
16
|
+
*
|
|
17
|
+
* @param str Field name to trim
|
|
18
|
+
* @return The field name without the surrounding SP and HTAB
|
|
19
|
+
*/
|
|
20
|
+
function _trimFieldName(str) {
|
|
21
|
+
let start = 0;
|
|
22
|
+
let end = str.length;
|
|
23
|
+
while (start < end && (str.charCodeAt(start) === 0x20 || str.charCodeAt(start) === 0x09)) {
|
|
24
|
+
start++;
|
|
25
|
+
}
|
|
26
|
+
while (end > start && (str.charCodeAt(end - 1) === 0x20 || str.charCodeAt(end - 1) === 0x09)) {
|
|
27
|
+
end--;
|
|
28
|
+
}
|
|
29
|
+
return str.slice(start, end);
|
|
30
|
+
}
|
|
4
31
|
/**
|
|
5
32
|
* MessageParser instance is a transform stream that separates message headers
|
|
6
33
|
* from the rest of the body. Headers are emitted with the 'headers' event. Message
|
|
@@ -143,10 +170,7 @@ class MessageParser extends node_stream_1.Transform {
|
|
|
143
170
|
return lines
|
|
144
171
|
.filter(line => /[^ \t\r]/.test(line))
|
|
145
172
|
.map(line => ({
|
|
146
|
-
key: line
|
|
147
|
-
.substr(0, line.indexOf(':'))
|
|
148
|
-
.replace(/^[ \t]+|[ \t]+$/g, '')
|
|
149
|
-
.toLowerCase(),
|
|
173
|
+
key: _trimFieldName(line.substr(0, line.indexOf(':'))).toLowerCase(),
|
|
150
174
|
line
|
|
151
175
|
}));
|
|
152
176
|
}
|
package/dist/cjs/dkim/sign.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export interface DKIMRelaxedHeaders {
|
|
|
36
36
|
* Returns DKIM signature header line
|
|
37
37
|
*
|
|
38
38
|
* @param headers Parsed headers object from MessageParser
|
|
39
|
+
* @param hashAlgo Hash algorithm the body hash was calculated with, for example "sha256"
|
|
39
40
|
* @param bodyHash Base64 encoded hash of the message
|
|
40
41
|
* @param options DKIM options
|
|
41
42
|
* @param options.domainName Domain name to be signed for
|
package/dist/cjs/dkim/sign.js
CHANGED
|
@@ -52,6 +52,7 @@ function unsupportedHashAlgoError(hashAlgo) {
|
|
|
52
52
|
* Returns DKIM signature header line
|
|
53
53
|
*
|
|
54
54
|
* @param headers Parsed headers object from MessageParser
|
|
55
|
+
* @param hashAlgo Hash algorithm the body hash was calculated with, for example "sha256"
|
|
55
56
|
* @param bodyHash Base64 encoded hash of the message
|
|
56
57
|
* @param options DKIM options
|
|
57
58
|
* @param options.domainName Domain name to be signed for
|
package/dist/cjs/errors.d.ts
CHANGED
|
@@ -65,11 +65,11 @@ export declare const EFETCH = "EFETCH";
|
|
|
65
65
|
* An Error together with the properties Nodemailer attaches to the errors it
|
|
66
66
|
* hands to callers. Every property is optional, the set that is present
|
|
67
67
|
* depends on where the error originated. Socket level errors keep the errno
|
|
68
|
-
* and syscall fields Node.js sets on them.
|
|
68
|
+
* and syscall fields Node.js sets on them. `code` (see ERROR_CODES) is
|
|
69
|
+
* inherited from ErrnoException, not redeclared, so it follows the
|
|
70
|
+
* consumer's @types/node.
|
|
69
71
|
*/
|
|
70
72
|
export interface NodemailerError extends NodeJS.ErrnoException {
|
|
71
|
-
/** Nodemailer error code, see ERROR_CODES */
|
|
72
|
-
code?: string | undefined;
|
|
73
73
|
/** SMTP command that was in flight when the server replied with an error */
|
|
74
74
|
command?: string | undefined;
|
|
75
75
|
/** Raw SMTP server response */
|
|
@@ -193,9 +193,15 @@ declare class Mail<out T = SentMessageInfo, out D extends TransportOptions = Tra
|
|
|
193
193
|
* Sends an email using the preselected transport object
|
|
194
194
|
*
|
|
195
195
|
* @param data E-data description
|
|
196
|
-
* @
|
|
196
|
+
* @returns Promise that resolves with the result of the send
|
|
197
197
|
*/
|
|
198
198
|
sendMail(data: SendMailOptions): Promise<T>;
|
|
199
|
+
/**
|
|
200
|
+
* Sends an email using the preselected transport object
|
|
201
|
+
*
|
|
202
|
+
* @param data E-data description
|
|
203
|
+
* @param callback Callback to run once the sending succeeded or failed
|
|
204
|
+
*/
|
|
199
205
|
sendMail(data: SendMailOptions, callback: SendMailCallback<T>): void;
|
|
200
206
|
getVersionString(): string;
|
|
201
207
|
/**
|
|
@@ -59,6 +59,7 @@ export declare function quoteString(value?: string): string;
|
|
|
59
59
|
* no need to encode the values in any way. If the value is plaintext but has
|
|
60
60
|
* longer lines then allowed, then use format=flowed
|
|
61
61
|
*
|
|
62
|
+
* @param str Multi line string to check
|
|
62
63
|
* @param lineLength Max line length to check for
|
|
63
64
|
* @returns Returns true if there is at least one line longer than lineLength chars
|
|
64
65
|
*/
|
|
@@ -100,9 +101,9 @@ export declare function buildHeaderValue(structured: StructuredHeaderValue): str
|
|
|
100
101
|
* title*0*=utf-8''unicode
|
|
101
102
|
* title*1*=%20string
|
|
102
103
|
*
|
|
104
|
+
* @param key Parameter name the generated keys are built from, for example title
|
|
103
105
|
* @param data String to be encoded
|
|
104
106
|
* @param [maxLength=50] Max length for generated chunks
|
|
105
|
-
* @param [fromCharset='UTF-8'] Source sharacter set
|
|
106
107
|
* @return A list of encoded keys and headers
|
|
107
108
|
*/
|
|
108
109
|
export declare function buildHeaderParam(key: string, data: string | Buffer, maxLength?: number): EncodedHeaderParam[];
|