nodemailer 10.0.0 → 10.0.1
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 +8 -0
- package/dist/cjs/addressparser/index.d.ts +1 -3
- package/dist/cjs/base64/index.d.ts +2 -6
- package/dist/cjs/base64/index.js +2 -0
- package/dist/cjs/dkim/index.d.ts +4 -4
- package/dist/cjs/dkim/message-parser.d.ts +1 -3
- package/dist/cjs/dkim/message-parser.js +2 -0
- package/dist/cjs/dkim/relaxed-body.d.ts +3 -22
- package/dist/cjs/dkim/relaxed-body.js +5 -0
- package/dist/cjs/dkim/sign.d.ts +5 -5
- package/dist/cjs/errors.d.ts +8 -8
- package/dist/cjs/fetch/cookies.d.ts +8 -8
- package/dist/cjs/fetch/index.d.ts +15 -15
- package/dist/cjs/json-transport/index.d.ts +2 -2
- package/dist/cjs/mail-composer/index.d.ts +49 -104
- package/dist/cjs/mail-composer/index.js +6 -0
- package/dist/cjs/mailer/index.d.ts +21 -28
- package/dist/cjs/mailer/index.js +2 -0
- package/dist/cjs/mailer/mail-message.d.ts +8 -12
- package/dist/cjs/mailer/mail-message.js +2 -0
- package/dist/cjs/mime-funcs/index.d.ts +1 -1
- package/dist/cjs/mime-node/index.d.ts +37 -191
- package/dist/cjs/mime-node/index.js +17 -0
- package/dist/cjs/mime-node/last-newline.d.ts +1 -3
- package/dist/cjs/mime-node/last-newline.js +2 -0
- package/dist/cjs/mime-node/le-unix.d.ts +1 -5
- package/dist/cjs/mime-node/le-unix.js +1 -0
- package/dist/cjs/mime-node/le-windows.d.ts +1 -5
- package/dist/cjs/mime-node/le-windows.js +1 -0
- package/dist/cjs/nodemailer.d.ts +2 -2
- package/dist/cjs/package-info.d.ts +1 -1
- package/dist/cjs/package-info.js +1 -1
- package/dist/cjs/qp/index.d.ts +2 -5
- package/dist/cjs/qp/index.js +2 -0
- package/dist/cjs/sendmail-transport/index.d.ts +4 -6
- package/dist/cjs/ses-transport/index.d.ts +2 -2
- package/dist/cjs/shared/index.d.ts +31 -36
- package/dist/cjs/shared/index.js +3 -0
- package/dist/cjs/smtp-connection/data-stream.d.ts +1 -9
- package/dist/cjs/smtp-connection/data-stream.js +2 -0
- package/dist/cjs/smtp-connection/http-proxy-client.d.ts +1 -1
- package/dist/cjs/smtp-connection/index.d.ts +62 -403
- package/dist/cjs/smtp-connection/index.js +37 -1
- package/dist/cjs/smtp-pool/index.d.ts +8 -46
- package/dist/cjs/smtp-pool/index.js +9 -0
- package/dist/cjs/smtp-pool/pool-resource.d.ts +2 -4
- package/dist/cjs/smtp-transport/index.d.ts +16 -16
- package/dist/cjs/stream-transport/index.d.ts +3 -3
- package/dist/cjs/well-known/index.d.ts +9 -9
- package/dist/cjs/xoauth2/index.d.ts +18 -18
- package/dist/esm/addressparser/index.d.ts +1 -3
- package/dist/esm/base64/index.d.ts +2 -6
- package/dist/esm/base64/index.js +2 -0
- package/dist/esm/dkim/index.d.ts +4 -4
- package/dist/esm/dkim/message-parser.d.ts +1 -3
- package/dist/esm/dkim/message-parser.js +2 -0
- package/dist/esm/dkim/relaxed-body.d.ts +3 -22
- package/dist/esm/dkim/relaxed-body.js +5 -0
- package/dist/esm/dkim/sign.d.ts +5 -5
- package/dist/esm/errors.d.ts +8 -8
- package/dist/esm/fetch/cookies.d.ts +8 -8
- package/dist/esm/fetch/index.d.ts +15 -15
- package/dist/esm/json-transport/index.d.ts +2 -2
- package/dist/esm/mail-composer/index.d.ts +49 -104
- package/dist/esm/mail-composer/index.js +6 -0
- package/dist/esm/mailer/index.d.ts +21 -28
- package/dist/esm/mailer/index.js +2 -0
- package/dist/esm/mailer/mail-message.d.ts +8 -12
- package/dist/esm/mailer/mail-message.js +2 -0
- package/dist/esm/mime-funcs/index.d.ts +1 -1
- package/dist/esm/mime-node/index.d.ts +37 -191
- package/dist/esm/mime-node/index.js +17 -0
- package/dist/esm/mime-node/last-newline.d.ts +1 -3
- package/dist/esm/mime-node/last-newline.js +2 -0
- package/dist/esm/mime-node/le-unix.d.ts +1 -5
- package/dist/esm/mime-node/le-unix.js +1 -0
- package/dist/esm/mime-node/le-windows.d.ts +1 -5
- package/dist/esm/mime-node/le-windows.js +1 -0
- package/dist/esm/nodemailer.d.ts +2 -2
- package/dist/esm/package-info.d.ts +1 -1
- package/dist/esm/package-info.js +1 -1
- package/dist/esm/qp/index.d.ts +2 -5
- package/dist/esm/qp/index.js +2 -0
- package/dist/esm/sendmail-transport/index.d.ts +4 -6
- package/dist/esm/ses-transport/index.d.ts +2 -2
- package/dist/esm/shared/index.d.ts +31 -36
- package/dist/esm/shared/index.js +3 -0
- package/dist/esm/smtp-connection/data-stream.d.ts +1 -9
- package/dist/esm/smtp-connection/data-stream.js +2 -0
- package/dist/esm/smtp-connection/http-proxy-client.d.ts +1 -1
- package/dist/esm/smtp-connection/index.d.ts +62 -403
- package/dist/esm/smtp-connection/index.js +37 -1
- package/dist/esm/smtp-pool/index.d.ts +8 -46
- package/dist/esm/smtp-pool/index.js +9 -0
- package/dist/esm/smtp-pool/pool-resource.d.ts +2 -4
- package/dist/esm/smtp-transport/index.d.ts +16 -16
- package/dist/esm/stream-transport/index.d.ts +3 -3
- package/dist/esm/well-known/index.d.ts +9 -9
- package/dist/esm/xoauth2/index.d.ts +18 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## [10.0.1](https://github.com/nodemailer/nodemailer/compare/v10.0.0...v10.0.1) (2026-09-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **types:** accept an explicit undefined for optional properties ([209719d](https://github.com/nodemailer/nodemailer/commit/209719dd6a192656a6b18de265a3b4ac387208ff)), closes [#1853](https://github.com/nodemailer/nodemailer/issues/1853)
|
|
9
|
+
* **types:** drop the internal members from the published declarations ([81e64ea](https://github.com/nodemailer/nodemailer/commit/81e64eaee70aabf867afef88d3733556c9fcc1cc))
|
|
10
|
+
|
|
3
11
|
## [10.0.0](https://github.com/nodemailer/nodemailer/compare/v9.1.1...v10.0.0) (2026-09-03)
|
|
4
12
|
|
|
5
13
|
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface AddressParserOptions {
|
|
5
5
|
/** Flatten groups into a single list of mailboxes */
|
|
6
|
-
flatten?: boolean;
|
|
7
|
-
/** Internal recursion depth counter (do not set manually) */
|
|
8
|
-
_depth?: number;
|
|
6
|
+
flatten?: boolean | undefined;
|
|
9
7
|
}
|
|
10
8
|
/**
|
|
11
9
|
* A single mailbox. Either value may be an empty string when the input did not carry it
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transform
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
2
|
/**
|
|
3
3
|
* Encodes a Buffer into a base64 encoded string
|
|
4
4
|
*
|
|
@@ -19,7 +19,7 @@ export declare function wrap(str: string, lineLength?: number | false): string;
|
|
|
19
19
|
*/
|
|
20
20
|
export interface EncoderOptions {
|
|
21
21
|
/** Maximum length for lines, set to false to disable wrapping */
|
|
22
|
-
lineLength?: number | false;
|
|
22
|
+
lineLength?: number | false | undefined;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Creates a transform stream for encoding data to base64 encoding
|
|
@@ -32,9 +32,5 @@ export declare class Encoder extends Transform {
|
|
|
32
32
|
options: EncoderOptions;
|
|
33
33
|
inputBytes: number;
|
|
34
34
|
outputBytes: number;
|
|
35
|
-
_curLine: string;
|
|
36
|
-
_remainingBytes: Buffer | false;
|
|
37
35
|
constructor(options?: EncoderOptions);
|
|
38
|
-
_transform(chunk: Buffer | string, encoding: BufferEncoding | 'buffer', done: TransformCallback): void;
|
|
39
|
-
_flush(done: TransformCallback): void;
|
|
40
36
|
}
|
package/dist/cjs/base64/index.js
CHANGED
|
@@ -59,6 +59,7 @@ class Encoder extends node_stream_1.Transform {
|
|
|
59
59
|
this.inputBytes = 0;
|
|
60
60
|
this.outputBytes = 0;
|
|
61
61
|
}
|
|
62
|
+
/** @internal */
|
|
62
63
|
_transform(chunk, encoding, done) {
|
|
63
64
|
let buf = encoding !== 'buffer' ? Buffer.from(chunk, encoding) : chunk;
|
|
64
65
|
if (!buf || !buf.length) {
|
|
@@ -100,6 +101,7 @@ class Encoder extends node_stream_1.Transform {
|
|
|
100
101
|
}
|
|
101
102
|
setImmediate(done);
|
|
102
103
|
}
|
|
104
|
+
/** @internal */
|
|
103
105
|
_flush(done) {
|
|
104
106
|
if (this._remainingBytes && this._remainingBytes.length) {
|
|
105
107
|
this._curLine += encode(this._remainingBytes);
|
package/dist/cjs/dkim/index.d.ts
CHANGED
|
@@ -9,13 +9,13 @@ export type { DKIMKey, DKIMPrivateKey, DKIMSignOptions };
|
|
|
9
9
|
*/
|
|
10
10
|
export interface DKIMOptions extends DKIMSignOptions {
|
|
11
11
|
/** One or more signing keys, used instead of the domainName, keySelector and privateKey options */
|
|
12
|
-
keys?: DKIMKey | DKIMKey[];
|
|
12
|
+
keys?: DKIMKey | DKIMKey[] | undefined;
|
|
13
13
|
/** Directory for buffering large message bodies to disk, no buffering when not set */
|
|
14
|
-
cacheDir?: string | false;
|
|
14
|
+
cacheDir?: string | false | undefined;
|
|
15
15
|
/** Body size in bytes from which the body is buffered to cacheDir, defaults to 10 MB */
|
|
16
|
-
cacheTreshold?: number;
|
|
16
|
+
cacheTreshold?: number | undefined;
|
|
17
17
|
/** Hash algorithm for the body hash and the signature, defaults to sha256 */
|
|
18
|
-
hashAlgo?: string;
|
|
18
|
+
hashAlgo?: string | undefined;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* The signed message as returned by DKIM#sign
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transform, type
|
|
1
|
+
import { Transform, type TransformOptions } from 'node:stream';
|
|
2
2
|
/**
|
|
3
3
|
* A header line as emitted with the 'headers' event
|
|
4
4
|
*/
|
|
@@ -35,7 +35,5 @@ export default class MessageParser extends Transform {
|
|
|
35
35
|
* @return Returns true if headers are already found or false otherwise
|
|
36
36
|
*/
|
|
37
37
|
checkHeaders(data: Buffer): boolean;
|
|
38
|
-
_transform(chunk: Buffer | string, encoding: BufferEncoding, callback: TransformCallback): void;
|
|
39
|
-
_flush(callback: TransformCallback): void;
|
|
40
38
|
parseHeaders(): MessageParserHeaderLine[];
|
|
41
39
|
}
|
|
@@ -90,6 +90,7 @@ class MessageParser extends node_stream_1.Transform {
|
|
|
90
90
|
this.updateLastBytes(data);
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
|
+
/** @internal */
|
|
93
94
|
_transform(chunk, encoding, callback) {
|
|
94
95
|
if (!chunk || !chunk.length) {
|
|
95
96
|
return callback();
|
|
@@ -110,6 +111,7 @@ class MessageParser extends node_stream_1.Transform {
|
|
|
110
111
|
}
|
|
111
112
|
setImmediate(callback);
|
|
112
113
|
}
|
|
114
|
+
/** @internal */
|
|
113
115
|
_flush(callback) {
|
|
114
116
|
if (this.headerChunks) {
|
|
115
117
|
// no empty line was seen, so the message consists of headers only
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Transform
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
3
|
/**
|
|
4
4
|
* Options for the relaxed body hash stream
|
|
5
5
|
*/
|
|
6
6
|
export interface RelaxedBodyOptions {
|
|
7
7
|
/** Hash algorithm for the body hash, defaults to sha256 */
|
|
8
|
-
hashAlgo?: string;
|
|
8
|
+
hashAlgo?: string | undefined;
|
|
9
9
|
/** Collect the canonicalized body and emit it with the 'hash' event */
|
|
10
|
-
debug?: boolean;
|
|
10
|
+
debug?: boolean | undefined;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Passes the message body through unchanged and hashes its relaxed
|
|
@@ -22,25 +22,6 @@ export default class RelaxedBody extends Transform {
|
|
|
22
22
|
/** Bytes of the original body seen so far */
|
|
23
23
|
byteLength: number;
|
|
24
24
|
debug: boolean | undefined;
|
|
25
|
-
_debugBody: Buffer[] | false;
|
|
26
|
-
/** The current line has bytes that survive canonicalization */
|
|
27
|
-
_lineHasContent: boolean;
|
|
28
|
-
/** Whitespace that ends up as a single space if more content follows on the line */
|
|
29
|
-
_pendingWsp: boolean;
|
|
30
|
-
/** A CR that is part of the line ending if LF follows, otherwise content */
|
|
31
|
-
_pendingCr: boolean;
|
|
32
|
-
/** Empty lines that are hashed only once a non-empty line follows them */
|
|
33
|
-
_pendingEmptyLines: number;
|
|
34
25
|
constructor(options?: RelaxedBodyOptions);
|
|
35
|
-
_hashCanonical(data: Buffer): void;
|
|
36
|
-
_hashEmptyLines(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Writes a content byte, with the space a pending run of whitespace collapses to,
|
|
39
|
-
* into the output buffer and returns the new write position. Kept a method rather
|
|
40
|
-
* than a closure so the write position stays a plain local in the byte loop
|
|
41
|
-
*/
|
|
42
|
-
_emitContent(out: Buffer, outPos: number, c: number): number;
|
|
43
26
|
updateHash(chunk: Buffer, final?: boolean): void;
|
|
44
|
-
_transform(chunk: Buffer | string, encoding: BufferEncoding, callback: TransformCallback): void;
|
|
45
|
-
_flush(callback: TransformCallback): void;
|
|
46
27
|
}
|
|
@@ -34,6 +34,7 @@ class RelaxedBody extends node_stream_1.Transform {
|
|
|
34
34
|
this._pendingCr = false;
|
|
35
35
|
this._pendingEmptyLines = 0;
|
|
36
36
|
}
|
|
37
|
+
/** @internal */
|
|
37
38
|
_hashCanonical(data) {
|
|
38
39
|
if (!data.length) {
|
|
39
40
|
return;
|
|
@@ -43,6 +44,7 @@ class RelaxedBody extends node_stream_1.Transform {
|
|
|
43
44
|
this._debugBody.push(Buffer.from(data));
|
|
44
45
|
}
|
|
45
46
|
}
|
|
47
|
+
/** @internal */
|
|
46
48
|
_hashEmptyLines() {
|
|
47
49
|
while (this._pendingEmptyLines > 0) {
|
|
48
50
|
const count = Math.min(this._pendingEmptyLines, EMPTY_LINES.length / 2);
|
|
@@ -54,6 +56,7 @@ class RelaxedBody extends node_stream_1.Transform {
|
|
|
54
56
|
* Writes a content byte, with the space a pending run of whitespace collapses to,
|
|
55
57
|
* into the output buffer and returns the new write position. Kept a method rather
|
|
56
58
|
* than a closure so the write position stays a plain local in the byte loop
|
|
59
|
+
* @internal
|
|
57
60
|
*/
|
|
58
61
|
_emitContent(out, outPos, c) {
|
|
59
62
|
if (!this._lineHasContent) {
|
|
@@ -116,6 +119,7 @@ class RelaxedBody extends node_stream_1.Transform {
|
|
|
116
119
|
}
|
|
117
120
|
this._hashCanonical(out.subarray(0, outPos));
|
|
118
121
|
}
|
|
122
|
+
/** @internal */
|
|
119
123
|
_transform(chunk, encoding, callback) {
|
|
120
124
|
if (!chunk || !chunk.length) {
|
|
121
125
|
return callback();
|
|
@@ -128,6 +132,7 @@ class RelaxedBody extends node_stream_1.Transform {
|
|
|
128
132
|
this.push(chunk);
|
|
129
133
|
callback();
|
|
130
134
|
}
|
|
135
|
+
/** @internal */
|
|
131
136
|
_flush(callback) {
|
|
132
137
|
this.updateHash(Buffer.alloc(0), true);
|
|
133
138
|
if (this._lineHasContent) {
|
package/dist/cjs/dkim/sign.d.ts
CHANGED
|
@@ -10,17 +10,17 @@ export type DKIMPrivateKey = crypto.KeyLike | crypto.SignKeyObjectInput | crypto
|
|
|
10
10
|
*/
|
|
11
11
|
export interface DKIMKey {
|
|
12
12
|
/** Domain name to be signed for */
|
|
13
|
-
domainName?: string;
|
|
13
|
+
domainName?: string | undefined;
|
|
14
14
|
/** DKIM key selector to use */
|
|
15
|
-
keySelector?: string;
|
|
15
|
+
keySelector?: string | undefined;
|
|
16
16
|
/** DKIM private key to use */
|
|
17
|
-
privateKey?: DKIMPrivateKey;
|
|
17
|
+
privateKey?: DKIMPrivateKey | undefined;
|
|
18
18
|
}
|
|
19
19
|
export interface DKIMSignOptions extends DKIMKey {
|
|
20
20
|
/** Colon separated list of header field names to sign, defaults to the RFC4871 list */
|
|
21
|
-
headerFieldNames?: string;
|
|
21
|
+
headerFieldNames?: string | undefined;
|
|
22
22
|
/** Colon separated list of header field names to leave out of the signature */
|
|
23
|
-
skipFields?: string;
|
|
23
|
+
skipFields?: string | undefined;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Canonicalized headers and the list of field names that went into them
|
package/dist/cjs/errors.d.ts
CHANGED
|
@@ -68,21 +68,21 @@ export declare const EFETCH = "EFETCH";
|
|
|
68
68
|
*/
|
|
69
69
|
export interface NodemailerError extends Error {
|
|
70
70
|
/** Nodemailer error code, see ERROR_CODES */
|
|
71
|
-
code?: string;
|
|
71
|
+
code?: string | undefined;
|
|
72
72
|
/** SMTP command that was in flight when the server replied with an error */
|
|
73
|
-
command?: string;
|
|
73
|
+
command?: string | undefined;
|
|
74
74
|
/** Raw SMTP server response */
|
|
75
|
-
response?: string;
|
|
75
|
+
response?: string | undefined;
|
|
76
76
|
/** Numeric SMTP response code */
|
|
77
|
-
responseCode?: number;
|
|
77
|
+
responseCode?: number | undefined;
|
|
78
78
|
/** URL of the resource that could not be fetched */
|
|
79
|
-
sourceUrl?: string;
|
|
79
|
+
sourceUrl?: string | undefined;
|
|
80
80
|
/** Recipient address the error applies to */
|
|
81
|
-
recipient?: string;
|
|
81
|
+
recipient?: string | undefined;
|
|
82
82
|
/** Recipient addresses rejected by the server */
|
|
83
|
-
rejected?: string[];
|
|
83
|
+
rejected?: string[] | undefined;
|
|
84
84
|
/** Per-recipient errors for the rejected addresses */
|
|
85
|
-
rejectedErrors?: NodemailerError[];
|
|
85
|
+
rejectedErrors?: NodemailerError[] | undefined;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Node style callback: called with an error, or with null and the result
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface CookiesOptions {
|
|
5
5
|
/** Lifetime in seconds for cookies that do not set their own expiration (default 1800) */
|
|
6
|
-
sessionTimeout?: number | string;
|
|
6
|
+
sessionTimeout?: number | string | undefined;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* A cookie as parsed from a 'Set-Cookie:' header and kept in the jar
|
|
10
10
|
*/
|
|
11
11
|
export interface Cookie {
|
|
12
|
-
name?: string;
|
|
13
|
-
value?: string;
|
|
14
|
-
domain?: string;
|
|
15
|
-
path?: string;
|
|
16
|
-
expires?: Date;
|
|
17
|
-
secure?: boolean;
|
|
18
|
-
httponly?: boolean;
|
|
12
|
+
name?: string | undefined;
|
|
13
|
+
value?: string | undefined;
|
|
14
|
+
domain?: string | undefined;
|
|
15
|
+
path?: string | undefined;
|
|
16
|
+
expires?: Date | undefined;
|
|
17
|
+
secure?: boolean | undefined;
|
|
18
|
+
httponly?: boolean | undefined;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Creates a biskviit cookie jar for managing cookie values in memory
|
|
@@ -6,43 +6,43 @@ import Cookies from './cookies.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface FetchOptions {
|
|
8
8
|
/** HTTP method, defaults to GET, or to POST when a body is given */
|
|
9
|
-
method?: string;
|
|
9
|
+
method?: string | undefined;
|
|
10
10
|
/** Request headers, keys are lowercased before use */
|
|
11
|
-
headers?: http.OutgoingHttpHeaders;
|
|
11
|
+
headers?: http.OutgoingHttpHeaders | undefined;
|
|
12
12
|
/** Overrides the default User-Agent header */
|
|
13
|
-
userAgent?: string;
|
|
13
|
+
userAgent?: string | undefined;
|
|
14
14
|
/** Cookie string(s) to seed the cookie jar with for this URL */
|
|
15
|
-
cookie?: string | string[] | false;
|
|
15
|
+
cookie?: string | string[] | false | undefined;
|
|
16
16
|
/** Cookie jar shared across redirects, created when missing */
|
|
17
|
-
cookies?: Cookies;
|
|
17
|
+
cookies?: Cookies | undefined;
|
|
18
18
|
/** Request body: a readable stream, a Buffer, a form object or a string */
|
|
19
19
|
body?: Readable | Buffer | {
|
|
20
20
|
[key: string]: any;
|
|
21
|
-
} | string | false;
|
|
21
|
+
} | string | false | undefined;
|
|
22
22
|
/** Content-Type header for the body, false leaves it out for a stream body */
|
|
23
|
-
contentType?: string | false;
|
|
23
|
+
contentType?: string | false | undefined;
|
|
24
24
|
/** TLS settings, only the keys listed in TLS_OPTION_KEYS are used */
|
|
25
25
|
tls?: {
|
|
26
26
|
[key: string]: any;
|
|
27
|
-
};
|
|
27
|
+
} | undefined;
|
|
28
28
|
/** Request timeout in milliseconds */
|
|
29
|
-
timeout?: number;
|
|
29
|
+
timeout?: number | undefined;
|
|
30
30
|
/** Maximum number of redirects to follow (default 5) */
|
|
31
|
-
maxRedirects?: number;
|
|
31
|
+
maxRedirects?: number | undefined;
|
|
32
32
|
/** Resolve responses with a status code of 300 or above instead of emitting an error */
|
|
33
|
-
allowErrorResponse?: boolean;
|
|
33
|
+
allowErrorResponse?: boolean | undefined;
|
|
34
34
|
/** Redirects followed so far, set by nmfetch itself */
|
|
35
|
-
redirects?: number;
|
|
35
|
+
redirects?: number | undefined;
|
|
36
36
|
/** Response stream shared across redirects, set by nmfetch itself */
|
|
37
|
-
fetchRes?: FetchResponse;
|
|
37
|
+
fetchRes?: FetchResponse | undefined;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* The stream nmfetch returns. The response body is piped into it, the status code and
|
|
41
41
|
* headers of the final response are attached once they arrive
|
|
42
42
|
*/
|
|
43
43
|
export interface FetchResponse extends PassThrough {
|
|
44
|
-
statusCode?: number;
|
|
45
|
-
headers?: http.IncomingHttpHeaders;
|
|
44
|
+
statusCode?: number | undefined;
|
|
45
|
+
headers?: http.IncomingHttpHeaders | undefined;
|
|
46
46
|
}
|
|
47
47
|
declare function nmfetch(url: string, options?: FetchOptions): FetchResponse;
|
|
48
48
|
declare namespace nmfetch {
|
|
@@ -7,9 +7,9 @@ import type { default as Mail, SentMessageInfo, SendMailOptions, TransportOption
|
|
|
7
7
|
*/
|
|
8
8
|
export interface JSONTransportOptions extends TransportOptions {
|
|
9
9
|
/** Selects this transport in createTransport */
|
|
10
|
-
jsonTransport?: boolean;
|
|
10
|
+
jsonTransport?: boolean | undefined;
|
|
11
11
|
/** If true, the message is returned as an object instead of a JSON string */
|
|
12
|
-
skipEncoding?: boolean;
|
|
12
|
+
skipEncoding?: boolean | undefined;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* The value the JSON transport hands to the send callback
|
|
@@ -8,45 +8,45 @@ import type { OutgoingHttpHeaders } from 'node:http';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface MailComposerAlternative {
|
|
10
10
|
/** The content itself: a string, a Buffer, a readable stream or a content descriptor */
|
|
11
|
-
content?: MimeNodeContent;
|
|
11
|
+
content?: MimeNodeContent | undefined;
|
|
12
12
|
/** File path, data URI or http(s) URL to read the content from */
|
|
13
|
-
path?: string | false;
|
|
13
|
+
path?: string | false | undefined;
|
|
14
14
|
/** URL or data URI to fetch the content from */
|
|
15
|
-
href?: string | false;
|
|
15
|
+
href?: string | false | undefined;
|
|
16
16
|
/** Request headers for a URL fetch */
|
|
17
|
-
httpHeaders?: OutgoingHttpHeaders;
|
|
17
|
+
httpHeaders?: OutgoingHttpHeaders | undefined;
|
|
18
18
|
/** TLS settings for a URL fetch, see nmfetch */
|
|
19
19
|
tls?: {
|
|
20
20
|
[key: string]: any;
|
|
21
|
-
};
|
|
21
|
+
} | undefined;
|
|
22
22
|
/** Encoding of a string `content`, decoded into a Buffer unless it is utf8 or ascii */
|
|
23
|
-
encoding?: string;
|
|
23
|
+
encoding?: string | undefined;
|
|
24
24
|
/** Pregenerated MIME part, used as is instead of building the node */
|
|
25
|
-
raw?: MimeNodeContent;
|
|
25
|
+
raw?: MimeNodeContent | undefined;
|
|
26
26
|
/** Content type, detected from the filename, path or URL when not set */
|
|
27
|
-
contentType?: string;
|
|
27
|
+
contentType?: string | undefined;
|
|
28
28
|
/** Content-Transfer-Encoding for the node, false leaves the choice to the node */
|
|
29
|
-
contentTransferEncoding?: string | false;
|
|
29
|
+
contentTransferEncoding?: string | false | undefined;
|
|
30
30
|
/** Filename for the node, false suppresses the generated one */
|
|
31
|
-
filename?: string | false;
|
|
31
|
+
filename?: string | false | undefined;
|
|
32
32
|
/** Additional headers for the node */
|
|
33
|
-
headers?: MimeNodeHeaders;
|
|
33
|
+
headers?: MimeNodeHeaders | undefined;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* An attachment, the shape of the attachments entries
|
|
37
37
|
*/
|
|
38
38
|
export interface MailComposerAttachment extends MailComposerAlternative {
|
|
39
39
|
/** Content-Disposition for the node, 'attachment' by default and 'inline' for a message node or an image with a cid */
|
|
40
|
-
contentDisposition?: string;
|
|
40
|
+
contentDisposition?: string | undefined;
|
|
41
41
|
/** Content-Id for an embedded image, moves the attachment into the multipart/related node beside the html */
|
|
42
|
-
cid?: string;
|
|
42
|
+
cid?: string | undefined;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* The icalEvent value as an object
|
|
46
46
|
*/
|
|
47
47
|
export interface MailComposerIcalEvent extends MailComposerAlternative {
|
|
48
48
|
/** iCalendar method, PUBLISH by default */
|
|
49
|
-
method?: string;
|
|
49
|
+
method?: string | undefined;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* The attachments as sorted by getAttachments
|
|
@@ -62,7 +62,7 @@ export interface MailComposerAttachments {
|
|
|
62
62
|
*/
|
|
63
63
|
export type MailComposerListHeaderEntry = string | {
|
|
64
64
|
url: string;
|
|
65
|
-
comment?: string;
|
|
65
|
+
comment?: string | undefined;
|
|
66
66
|
};
|
|
67
67
|
/**
|
|
68
68
|
* The list value: List-* headers keyed by the part after "List-" (help, unsubscribe,
|
|
@@ -79,75 +79,68 @@ export interface MailComposerListHeaders {
|
|
|
79
79
|
* by MailComposer itself, these are marked as such
|
|
80
80
|
*/
|
|
81
81
|
export interface MailComposerOptions {
|
|
82
|
-
from?: MimeNodeAddressInput;
|
|
83
|
-
sender?: MimeNodeAddressInput;
|
|
84
|
-
to?: MimeNodeAddressInput;
|
|
85
|
-
cc?: MimeNodeAddressInput;
|
|
86
|
-
bcc?: MimeNodeAddressInput;
|
|
87
|
-
replyTo?: MimeNodeAddressInput;
|
|
88
|
-
inReplyTo?: string;
|
|
89
|
-
references?: string | string[];
|
|
90
|
-
subject?: string;
|
|
82
|
+
from?: MimeNodeAddressInput | undefined;
|
|
83
|
+
sender?: MimeNodeAddressInput | undefined;
|
|
84
|
+
to?: MimeNodeAddressInput | undefined;
|
|
85
|
+
cc?: MimeNodeAddressInput | undefined;
|
|
86
|
+
bcc?: MimeNodeAddressInput | undefined;
|
|
87
|
+
replyTo?: MimeNodeAddressInput | undefined;
|
|
88
|
+
inReplyTo?: string | undefined;
|
|
89
|
+
references?: string | string[] | undefined;
|
|
90
|
+
subject?: string | undefined;
|
|
91
91
|
/** Message-ID header value, generated when missing */
|
|
92
|
-
messageId?: string;
|
|
92
|
+
messageId?: string | undefined;
|
|
93
93
|
/** Date header value, the current time when missing */
|
|
94
|
-
date?: Date | string;
|
|
94
|
+
date?: Date | string | undefined;
|
|
95
95
|
/** Plaintext version of the message */
|
|
96
|
-
text?: string | Buffer | Readable | MailComposerAlternative;
|
|
96
|
+
text?: string | Buffer | Readable | MailComposerAlternative | undefined;
|
|
97
97
|
/** HTML version of the message */
|
|
98
|
-
html?: string | Buffer | Readable | MailComposerAlternative;
|
|
98
|
+
html?: string | Buffer | Readable | MailComposerAlternative | undefined;
|
|
99
99
|
/** Apple Watch specific HTML version of the message */
|
|
100
|
-
watchHtml?: string | Buffer | Readable | MailComposerAlternative;
|
|
100
|
+
watchHtml?: string | Buffer | Readable | MailComposerAlternative | undefined;
|
|
101
101
|
/** AMP4EMAIL version of the message */
|
|
102
|
-
amp?: string | Buffer | Readable | MailComposerAlternative;
|
|
102
|
+
amp?: string | Buffer | Readable | MailComposerAlternative | undefined;
|
|
103
103
|
/** iCalendar event, included both as a text/calendar alternative and as an application/ics attachment */
|
|
104
|
-
icalEvent?: string | Buffer | Readable | MailComposerIcalEvent;
|
|
105
|
-
attachments?: MailComposerAttachment[];
|
|
104
|
+
icalEvent?: string | Buffer | Readable | MailComposerIcalEvent | undefined;
|
|
105
|
+
attachments?: MailComposerAttachment[] | undefined;
|
|
106
106
|
/** Further alternatives for the multipart/alternative node, after text, watchHtml, amp, html and the calendar event */
|
|
107
|
-
alternatives?: MailComposerAlternative[];
|
|
107
|
+
alternatives?: MailComposerAlternative[] | undefined;
|
|
108
108
|
/** Custom headers for the root node, the standard headers above override them */
|
|
109
|
-
headers?: MimeNodeHeaders;
|
|
109
|
+
headers?: MimeNodeHeaders | undefined;
|
|
110
110
|
/** List-* headers, read by the mailer */
|
|
111
|
-
list?: MailComposerListHeaders;
|
|
111
|
+
list?: MailComposerListHeaders | undefined;
|
|
112
112
|
/** SMTP envelope to use instead of the one generated from the headers */
|
|
113
|
-
envelope?: MimeNodeEnvelopeInput;
|
|
113
|
+
envelope?: MimeNodeEnvelopeInput | undefined;
|
|
114
114
|
/** Content-Transfer-Encoding to force for the text/* nodes that do not set their own */
|
|
115
|
-
encoding?: string;
|
|
115
|
+
encoding?: string | undefined;
|
|
116
116
|
/** Header string encoding, 'Q' (the default) or 'B', 'quoted-printable' and 'base64' are accepted as well */
|
|
117
|
-
textEncoding?: string;
|
|
117
|
+
textEncoding?: string | undefined;
|
|
118
118
|
/** Pregenerated rfc822 message, used as is instead of building one */
|
|
119
|
-
raw?: MimeNodeContent;
|
|
119
|
+
raw?: MimeNodeContent | undefined;
|
|
120
120
|
/** Reject content that points to a URL */
|
|
121
|
-
disableUrlAccess?: boolean;
|
|
121
|
+
disableUrlAccess?: boolean | undefined;
|
|
122
122
|
/** Reject content that points to a file path */
|
|
123
|
-
disableFileAccess?: boolean;
|
|
123
|
+
disableFileAccess?: boolean | undefined;
|
|
124
124
|
/** Convert data: images in the html into embedded attachments, read by the mailer */
|
|
125
|
-
attachDataUrls?: boolean;
|
|
125
|
+
attachDataUrls?: boolean | undefined;
|
|
126
126
|
/** Prefix for the generated multipart boundaries */
|
|
127
|
-
boundaryPrefix?: string;
|
|
127
|
+
boundaryPrefix?: string | undefined;
|
|
128
128
|
/** Shared part of the unique multipart boundary */
|
|
129
|
-
baseBoundary?: string;
|
|
129
|
+
baseBoundary?: string | undefined;
|
|
130
130
|
/** 'win' for CRLF and 'linux' for LF line breaks in the generated message, kept as is when not set */
|
|
131
|
-
newline?: string;
|
|
131
|
+
newline?: string | undefined;
|
|
132
132
|
/** Keep the Bcc header in the generated message, listed for completeness, the transports set it on the message directly */
|
|
133
|
-
keepBcc?: boolean;
|
|
133
|
+
keepBcc?: boolean | undefined;
|
|
134
134
|
/** Method to normalize header keys for custom caseing */
|
|
135
|
-
normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'];
|
|
135
|
+
normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'] | undefined;
|
|
136
136
|
/** 'high', 'normal' or 'low', sets the priority headers, read by the mailer */
|
|
137
|
-
priority?: string;
|
|
137
|
+
priority?: string | undefined;
|
|
138
138
|
/** X-Mailer header value, false leaves the header out, read by the mailer */
|
|
139
|
-
xMailer?: string | false;
|
|
139
|
+
xMailer?: string | false | undefined;
|
|
140
140
|
}
|
|
141
141
|
declare class MailComposer {
|
|
142
142
|
mail: MailComposerOptions;
|
|
143
143
|
message: MimeNode | false;
|
|
144
|
-
_alternatives: MailComposerAlternative[];
|
|
145
|
-
_htmlNode: MailComposerAlternative | undefined;
|
|
146
|
-
_attachments: MailComposerAttachments;
|
|
147
|
-
_useRelated: boolean;
|
|
148
|
-
_useAlternative: boolean;
|
|
149
|
-
_useMixed: boolean | number;
|
|
150
|
-
_icalEvent: MailComposerIcalEvent | undefined;
|
|
151
144
|
constructor(mail?: MailComposerOptions);
|
|
152
145
|
/**
|
|
153
146
|
* Builds MimeNode instance
|
|
@@ -160,60 +153,12 @@ declare class MailComposer {
|
|
|
160
153
|
* @returns An object of arrays (`related` and `attached`)
|
|
161
154
|
*/
|
|
162
155
|
getAttachments(findRelated?: boolean): MailComposerAttachments;
|
|
163
|
-
/**
|
|
164
|
-
* Returns the icalEvent value with `path`/`href`/data uri input normalized into
|
|
165
|
-
* a `content` entry, the same way as for regular attachments. The same event is
|
|
166
|
-
* included twice (as a text/calendar alternative and as an application/ics
|
|
167
|
-
* attachment), so the shared content object is marked to be resolved just once
|
|
168
|
-
* and the buffered result is reused by the second node.
|
|
169
|
-
*
|
|
170
|
-
* @returns Normalized icalEvent data
|
|
171
|
-
*/
|
|
172
|
-
_getIcalEvent(): MailComposerIcalEvent;
|
|
173
156
|
/**
|
|
174
157
|
* List alternatives. Resulting objects can be used as input for MimeNode nodes
|
|
175
158
|
*
|
|
176
159
|
* @returns An array of alternative elements. Includes the `text` and `html` values as well
|
|
177
160
|
*/
|
|
178
161
|
getAlternatives(): MailComposerAlternative[];
|
|
179
|
-
/**
|
|
180
|
-
* Builds multipart/mixed node. It should always contain different type of elements on the same level
|
|
181
|
-
* eg. text + attachments
|
|
182
|
-
*
|
|
183
|
-
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
184
|
-
* @returns MimeNode node element
|
|
185
|
-
*/
|
|
186
|
-
_createMixed(parentNode?: MimeNode): MimeNode;
|
|
187
|
-
/**
|
|
188
|
-
* Builds multipart/alternative node. It should always contain same type of elements on the same level
|
|
189
|
-
* eg. text + html view of the same data
|
|
190
|
-
*
|
|
191
|
-
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
192
|
-
* @returns MimeNode node element
|
|
193
|
-
*/
|
|
194
|
-
_createAlternative(parentNode?: MimeNode): MimeNode;
|
|
195
|
-
/**
|
|
196
|
-
* Builds multipart/related node. It should always contain html node with related attachments
|
|
197
|
-
*
|
|
198
|
-
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
199
|
-
* @returns MimeNode node element
|
|
200
|
-
*/
|
|
201
|
-
_createRelated(parentNode?: MimeNode): MimeNode;
|
|
202
|
-
/**
|
|
203
|
-
* Creates a regular node with contents
|
|
204
|
-
*
|
|
205
|
-
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
206
|
-
* @param element Node data
|
|
207
|
-
* @returns MimeNode node element
|
|
208
|
-
*/
|
|
209
|
-
_createContentNode(parentNode: MimeNode | false, element?: MailComposerAttachment): MimeNode;
|
|
210
|
-
/**
|
|
211
|
-
* Parses data uri and converts it to a Buffer
|
|
212
|
-
*
|
|
213
|
-
* @param element Content element
|
|
214
|
-
* @return Parsed element
|
|
215
|
-
*/
|
|
216
|
-
_processDataUrl<T extends MailComposerAlternative>(element: T): T;
|
|
217
162
|
}
|
|
218
163
|
/**
|
|
219
164
|
* Type alias in the layout of the other modules (@types/nodemailer had no namespace for MailComposer)
|
|
@@ -219,6 +219,7 @@ class MailComposer {
|
|
|
219
219
|
* and the buffered result is reused by the second node.
|
|
220
220
|
*
|
|
221
221
|
* @returns Normalized icalEvent data
|
|
222
|
+
* @internal
|
|
222
223
|
*/
|
|
223
224
|
_getIcalEvent() {
|
|
224
225
|
if (!this._icalEvent) {
|
|
@@ -383,6 +384,7 @@ class MailComposer {
|
|
|
383
384
|
*
|
|
384
385
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
385
386
|
* @returns MimeNode node element
|
|
387
|
+
* @internal
|
|
386
388
|
*/
|
|
387
389
|
_createMixed(parentNode) {
|
|
388
390
|
const node = parentNode
|
|
@@ -424,6 +426,7 @@ class MailComposer {
|
|
|
424
426
|
*
|
|
425
427
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
426
428
|
* @returns MimeNode node element
|
|
429
|
+
* @internal
|
|
427
430
|
*/
|
|
428
431
|
_createAlternative(parentNode) {
|
|
429
432
|
const node = parentNode
|
|
@@ -457,6 +460,7 @@ class MailComposer {
|
|
|
457
460
|
*
|
|
458
461
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
459
462
|
* @returns MimeNode node element
|
|
463
|
+
* @internal
|
|
460
464
|
*/
|
|
461
465
|
_createRelated(parentNode) {
|
|
462
466
|
const node = parentNode
|
|
@@ -485,6 +489,7 @@ class MailComposer {
|
|
|
485
489
|
* @param parentNode Parent for this note. If it does not exist, a root node is created
|
|
486
490
|
* @param element Node data
|
|
487
491
|
* @returns MimeNode node element
|
|
492
|
+
* @internal
|
|
488
493
|
*/
|
|
489
494
|
_createContentNode(parentNode, element) {
|
|
490
495
|
element = element || {};
|
|
@@ -545,6 +550,7 @@ class MailComposer {
|
|
|
545
550
|
*
|
|
546
551
|
* @param element Content element
|
|
547
552
|
* @return Parsed element
|
|
553
|
+
* @internal
|
|
548
554
|
*/
|
|
549
555
|
_processDataUrl(element) {
|
|
550
556
|
const dataUrl = element.path || element.href;
|