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.
- package/CHANGELOG.md +16 -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 +19 -5
- 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 +45 -7
- 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 -37
- package/dist/cjs/shared/index.js +19 -7
- 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 +19 -5
- 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 +45 -7
- 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 -37
- package/dist/esm/shared/index.js +19 -7
- 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
|
@@ -25,13 +25,13 @@ export interface SentMessageInfo {
|
|
|
25
25
|
/** Message-ID of the sent message */
|
|
26
26
|
messageId: string;
|
|
27
27
|
/** Recipient addresses the transport accepted */
|
|
28
|
-
accepted?: string[];
|
|
28
|
+
accepted?: string[] | undefined;
|
|
29
29
|
/** Recipient addresses the transport rejected */
|
|
30
|
-
rejected?: string[];
|
|
30
|
+
rejected?: string[] | undefined;
|
|
31
31
|
/** Recipient addresses left pending, LMTP reports these */
|
|
32
|
-
pending?: string[];
|
|
32
|
+
pending?: string[] | undefined;
|
|
33
33
|
/** Last response from the server */
|
|
34
|
-
response?: string;
|
|
34
|
+
response?: string | undefined;
|
|
35
35
|
/** The generated message, for the transports that hand it back instead of sending it */
|
|
36
36
|
message?: unknown;
|
|
37
37
|
/** Transport specific fields */
|
|
@@ -59,8 +59,8 @@ export type PluginFunction<T = SentMessageInfo> = (mail: MailMessage<T>, callbac
|
|
|
59
59
|
* the socket, with the host and port to connect to
|
|
60
60
|
*/
|
|
61
61
|
export interface GetSocketOptions {
|
|
62
|
-
host?: string;
|
|
63
|
-
port?: number | string;
|
|
62
|
+
host?: string | undefined;
|
|
63
|
+
port?: number | string | undefined;
|
|
64
64
|
[key: string]: any;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -68,7 +68,7 @@ export interface GetSocketOptions {
|
|
|
68
68
|
*/
|
|
69
69
|
export interface SocketOptions {
|
|
70
70
|
/** An established socket, the proxied connection */
|
|
71
|
-
connection?: net.Socket;
|
|
71
|
+
connection?: net.Socket | undefined;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Receives the socket options from a getSocket handler, or the error that prevented the
|
|
@@ -119,9 +119,9 @@ export interface Transport<T = SentMessageInfo> {
|
|
|
119
119
|
/** Registers an event listener, the transport may emit 'log', 'error', 'idle' and 'clear' */
|
|
120
120
|
on?(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
121
121
|
/** The Mail object the transport belongs to, set by Mail */
|
|
122
|
-
mailer?: Mail<T
|
|
122
|
+
mailer?: Mail<T> | undefined;
|
|
123
123
|
/** Socket handler for a proxied connection, set by Mail when a proxy is configured */
|
|
124
|
-
getSocket?: GetSocketHandler;
|
|
124
|
+
getSocket?: GetSocketHandler | undefined;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* Transport configuration as read by Mail itself. The transport reads its own options from
|
|
@@ -129,25 +129,25 @@ export interface Transport<T = SentMessageInfo> {
|
|
|
129
129
|
*/
|
|
130
130
|
export interface TransportOptions {
|
|
131
131
|
/** Bunyan compatible logger, true for the default console logger, false or unset for no logging */
|
|
132
|
-
logger?: shared.ExternalLogger | boolean;
|
|
132
|
+
logger?: shared.ExternalLogger | boolean | undefined;
|
|
133
133
|
/** Component name for the log lines, defaults to 'mail' */
|
|
134
|
-
component?: string;
|
|
134
|
+
component?: string | undefined;
|
|
135
135
|
/** DKIM signing options, every message is signed with these unless it carries its own */
|
|
136
|
-
dkim?: DKIMOptions;
|
|
136
|
+
dkim?: DKIMOptions | undefined;
|
|
137
137
|
/** Proxy url. http(s) proxies work as is, socks proxies need the socks module set with set('proxy_socks_module', socks) */
|
|
138
|
-
proxy?: string;
|
|
138
|
+
proxy?: string | undefined;
|
|
139
139
|
/** TLS options, rejectUnauthorized applies to an https proxy as well */
|
|
140
|
-
tls?: ConnectionOptions;
|
|
140
|
+
tls?: ConnectionOptions | undefined;
|
|
141
141
|
/** Reject content that points to a file path, forced onto every message */
|
|
142
|
-
disableFileAccess?: boolean;
|
|
142
|
+
disableFileAccess?: boolean | undefined;
|
|
143
143
|
/** Reject content that points to a URL, forced onto every message */
|
|
144
|
-
disableUrlAccess?: boolean;
|
|
144
|
+
disableUrlAccess?: boolean | undefined;
|
|
145
145
|
/** Method to normalize header keys for custom caseing, forced onto every message */
|
|
146
|
-
normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'];
|
|
146
|
+
normalizeHeaderKey?: MimeNodeOptions['normalizeHeaderKey'] | undefined;
|
|
147
147
|
/** Recipients allowed on one message, forced onto every message, 0 disables the limit, defaults to 100000 */
|
|
148
|
-
maxRecipients?: number;
|
|
148
|
+
maxRecipients?: number | undefined;
|
|
149
149
|
/** Convert data: images in the html into embedded attachments */
|
|
150
|
-
attachDataUrls?: boolean;
|
|
150
|
+
attachDataUrls?: boolean | undefined;
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* The transporter object createTransport returns, a Mail instance wrapping a transport
|
|
@@ -161,13 +161,8 @@ export type Transporter<T = SentMessageInfo> = Mail<T>;
|
|
|
161
161
|
*/
|
|
162
162
|
declare class Mail<out T = SentMessageInfo> extends EventEmitter {
|
|
163
163
|
options: TransportOptions;
|
|
164
|
+
/** Message defaults given to createTransport, kept public because the DefinitelyTyped typings declared it */
|
|
164
165
|
_defaults: MailDefaults;
|
|
165
|
-
_defaultPlugins: {
|
|
166
|
-
[step: string]: PluginFunction<any>[];
|
|
167
|
-
};
|
|
168
|
-
_userPlugins: {
|
|
169
|
-
[step: string]: PluginFunction<any>[];
|
|
170
|
-
};
|
|
171
166
|
meta: Map<string, any>;
|
|
172
167
|
dkim: DKIM | false;
|
|
173
168
|
transporter: Transport<T>;
|
|
@@ -182,7 +177,7 @@ declare class Mail<out T = SentMessageInfo> extends EventEmitter {
|
|
|
182
177
|
(): Promise<true>;
|
|
183
178
|
};
|
|
184
179
|
/** Socket handler for a proxied connection, set by setupProxy and handed to the transport on the next send */
|
|
185
|
-
getSocket?: GetSocketHandler | false;
|
|
180
|
+
getSocket?: GetSocketHandler | false | undefined;
|
|
186
181
|
constructor(transporter: Transport<T>, options?: TransportOptions, defaults?: MailDefaults);
|
|
187
182
|
use(step: string, plugin: PluginFunction<T>): this;
|
|
188
183
|
/**
|
|
@@ -194,14 +189,12 @@ declare class Mail<out T = SentMessageInfo> extends EventEmitter {
|
|
|
194
189
|
sendMail(data: SendMailOptions): Promise<T>;
|
|
195
190
|
sendMail(data: SendMailOptions, callback: SendMailCallback<T>): void;
|
|
196
191
|
getVersionString(): string;
|
|
197
|
-
_processPlugins(step: string, mail: MailMessage<T>, callback: PluginCallback): void;
|
|
198
192
|
/**
|
|
199
193
|
* Sets up proxy handler for a Nodemailer object
|
|
200
194
|
*
|
|
201
195
|
* @param proxyUrl Proxy configuration url
|
|
202
196
|
*/
|
|
203
197
|
setupProxy(proxyUrl: string): void;
|
|
204
|
-
_convertDataImages(mail: MailMessage<T>, callback: PluginCallback): void;
|
|
205
198
|
set<K extends keyof MailMeta & string>(key: K, value: MailMeta[K]): Map<string, any>;
|
|
206
199
|
get<K extends keyof MailMeta & string>(key: K): MailMeta[K] | undefined;
|
|
207
200
|
}
|
package/dist/cjs/mailer/index.js
CHANGED
|
@@ -172,12 +172,24 @@ class Mail extends node_events_1.EventEmitter {
|
|
|
172
172
|
}, 'PluginCompile Error: %s', err.message);
|
|
173
173
|
return done(err);
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
let recipientCount;
|
|
176
|
+
try {
|
|
177
|
+
mail.message = new index_js_1.default(mail.data).compile();
|
|
178
|
+
mail.setMailerHeader();
|
|
179
|
+
mail.setPriorityHeaders();
|
|
180
|
+
mail.setListHeaders();
|
|
181
|
+
recipientCount = mail.message.getEnvelope().to.length;
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
// message data can throw while it is compiled, the error belongs to the callback
|
|
185
|
+
this.logger.error({
|
|
186
|
+
err,
|
|
187
|
+
tnx: 'transport',
|
|
188
|
+
action: 'send'
|
|
189
|
+
}, 'Compile Error: %s', err.message);
|
|
190
|
+
return done(err);
|
|
191
|
+
}
|
|
179
192
|
const maxRecipients = mail.data.maxRecipients === undefined ? DEFAULT_MAX_RECIPIENTS : mail.data.maxRecipients;
|
|
180
|
-
const recipientCount = mail.message.getEnvelope().to.length;
|
|
181
193
|
if (maxRecipients && recipientCount > maxRecipients) {
|
|
182
194
|
const err = new Error(`Message has ${recipientCount} recipients, which is over the ${maxRecipients} allowed by maxRecipients`);
|
|
183
195
|
err.code = errors.EMAXRECIPIENTS;
|
|
@@ -225,6 +237,7 @@ class Mail extends node_events_1.EventEmitter {
|
|
|
225
237
|
getVersionString() {
|
|
226
238
|
return node_util_1.default.format('%s (%s; +%s; %s/%s)', packageData.name, packageData.version, packageData.homepage, this.transporter.name, this.transporter.version);
|
|
227
239
|
}
|
|
240
|
+
/** @internal */
|
|
228
241
|
_processPlugins(step, mail, callback) {
|
|
229
242
|
step = (step || '').toString();
|
|
230
243
|
if (!this._userPlugins.hasOwnProperty(step)) {
|
|
@@ -359,6 +372,7 @@ class Mail extends node_events_1.EventEmitter {
|
|
|
359
372
|
callback(err);
|
|
360
373
|
};
|
|
361
374
|
}
|
|
375
|
+
/** @internal */
|
|
362
376
|
_convertDataImages(mail, callback) {
|
|
363
377
|
if ((!this.options.attachDataUrls && !mail.data.attachDataUrls) || !mail.data.html) {
|
|
364
378
|
return callback();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MimeNode, { type MimeNodePreparedHeaderValue } from '../mime-node/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MailComposerOptions } from '../mail-composer/index.js';
|
|
3
3
|
import type { DKIMOptions } from '../dkim/index.js';
|
|
4
4
|
import type { SMTPEnvelopeDsn } from '../smtp-connection/index.js';
|
|
5
5
|
import type { SMTPTransportAuthOptions } from '../smtp-transport/index.js';
|
|
@@ -13,21 +13,19 @@ import type { SentMessageInfo } from './index.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface SendMailOptions extends MailComposerOptions {
|
|
15
15
|
/** DKIM signing options for this message, used instead of the ones of the transporter */
|
|
16
|
-
dkim?: DKIMOptions;
|
|
17
|
-
/** Extra DKIM options for this message, merged over the options of the signer */
|
|
18
|
-
_dkim?: DKIMOptions;
|
|
16
|
+
dkim?: DKIMOptions | undefined;
|
|
19
17
|
/** Recipients allowed on this message, 0 disables the limit, defaults to 100000 */
|
|
20
|
-
maxRecipients?: number;
|
|
18
|
+
maxRecipients?: number | undefined;
|
|
21
19
|
/** SMTP transports: DSN parameters for the envelope, sent when the server supports the DSN extension */
|
|
22
|
-
dsn?: SMTPEnvelopeDsn;
|
|
20
|
+
dsn?: SMTPEnvelopeDsn | undefined;
|
|
23
21
|
/** SMTP transports: RFC 8689, send the REQUIRETLS parameter with MAIL FROM */
|
|
24
|
-
requireTLSExtensionEnabled?: boolean;
|
|
22
|
+
requireTLSExtensionEnabled?: boolean | undefined;
|
|
25
23
|
/** SMTP transports: per-message authentication settings, used instead of the transport level auth */
|
|
26
|
-
auth?: SMTPTransportAuthOptions;
|
|
24
|
+
auth?: SMTPTransportAuthOptions | undefined;
|
|
27
25
|
/** SES transport: extra SendEmailCommand parameters merged into the API call */
|
|
28
26
|
ses?: {
|
|
29
27
|
[key: string]: unknown;
|
|
30
|
-
};
|
|
28
|
+
} | undefined;
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* Default message fields, the third argument of createTransport. Applied to every message
|
|
@@ -43,7 +41,7 @@ export interface MailMessageData extends SendMailOptions {
|
|
|
43
41
|
/** Header values flattened to strings and keyed by lowercase header name, set by normalize */
|
|
44
42
|
normalizedHeaders?: {
|
|
45
43
|
[key: string]: string;
|
|
46
|
-
};
|
|
44
|
+
} | undefined;
|
|
47
45
|
}
|
|
48
46
|
/**
|
|
49
47
|
* Callback for resolveAll and normalize, receives the message data with every content value
|
|
@@ -89,6 +87,4 @@ export default class MailMessage<T = SentMessageInfo> {
|
|
|
89
87
|
setMailerHeader(): void;
|
|
90
88
|
setPriorityHeaders(): void;
|
|
91
89
|
setListHeaders(): void;
|
|
92
|
-
_getListHeaders(listData: MailComposerListHeaders): MailMessageListHeader[];
|
|
93
|
-
_formatListUrl(url: string): string;
|
|
94
90
|
}
|
|
@@ -277,6 +277,7 @@ class MailMessage {
|
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
+
/** @internal */
|
|
280
281
|
_getListHeaders(listData) {
|
|
281
282
|
// make sure an url looks like <protocol:url>
|
|
282
283
|
return Object.keys(listData).map(key => ({
|
|
@@ -321,6 +322,7 @@ class MailMessage {
|
|
|
321
322
|
}))
|
|
322
323
|
}));
|
|
323
324
|
}
|
|
325
|
+
/** @internal */
|
|
324
326
|
_formatListUrl(url) {
|
|
325
327
|
// a url has no way to carry a control char or DEL, and the angle brackets around it
|
|
326
328
|
// are not a quoting construct, so anything left here lands in the header raw
|
|
@@ -14,7 +14,7 @@ export interface StructuredHeaderValue {
|
|
|
14
14
|
/** The value ahead of the parameters, for example the content type */
|
|
15
15
|
value: string | false;
|
|
16
16
|
/** Parameter values keyed by parameter name */
|
|
17
|
-
params?: Record<string, string
|
|
17
|
+
params?: Record<string, string> | undefined;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* A single key=value pair of an rfc2231 encoded header parameter
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type Duplex, type Readable, type TransformOptions, type Writable } from 'node:stream';
|
|
2
|
-
import * as mimeFuncs from '../mime-funcs/index.js';
|
|
3
|
-
import { type Address } from '../addressparser/index.js';
|
|
4
2
|
import type { NodemailerError } from '../errors.js';
|
|
5
3
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
6
4
|
/**
|
|
@@ -8,38 +6,38 @@ import type { OutgoingHttpHeaders } from 'node:http';
|
|
|
8
6
|
*/
|
|
9
7
|
export interface MimeNodeOptions {
|
|
10
8
|
/** root node for this tree */
|
|
11
|
-
rootNode?: MimeNode;
|
|
9
|
+
rootNode?: MimeNode | undefined;
|
|
12
10
|
/** immediate parent for this node */
|
|
13
|
-
parentNode?: MimeNode;
|
|
11
|
+
parentNode?: MimeNode | undefined;
|
|
14
12
|
/** filename for an attachment node */
|
|
15
|
-
filename?: string;
|
|
13
|
+
filename?: string | undefined;
|
|
16
14
|
/** shared part of the unique multipart boundary */
|
|
17
|
-
baseBoundary?: string;
|
|
15
|
+
baseBoundary?: string | undefined;
|
|
18
16
|
/** prefix for the generated multipart boundaries, defaults to '--_NmP' */
|
|
19
|
-
boundaryPrefix?: string;
|
|
17
|
+
boundaryPrefix?: string | undefined;
|
|
20
18
|
/** If true, do not exclude Bcc from the generated headers */
|
|
21
|
-
keepBcc?: boolean;
|
|
19
|
+
keepBcc?: boolean | undefined;
|
|
22
20
|
/** method to normalize header keys for custom caseing */
|
|
23
|
-
normalizeHeaderKey?: (key: string, value: string) => string;
|
|
21
|
+
normalizeHeaderKey?: ((key: string, value: string) => string) | undefined;
|
|
24
22
|
/** either 'Q' (the default) or 'B' */
|
|
25
|
-
textEncoding?: string;
|
|
23
|
+
textEncoding?: string | undefined;
|
|
26
24
|
/** Hostname for default message-id values */
|
|
27
|
-
hostname?: string;
|
|
25
|
+
hostname?: string | undefined;
|
|
28
26
|
/** If set to 'win' then uses \r\n, if 'linux' then \n. If not set (or `raw` is used) then newlines are kept as is */
|
|
29
|
-
newline?: string;
|
|
27
|
+
newline?: string | undefined;
|
|
30
28
|
/** Reject content that points to a file path, for this node and every node below it */
|
|
31
|
-
disableFileAccess?: boolean;
|
|
29
|
+
disableFileAccess?: boolean | undefined;
|
|
32
30
|
/** Reject content that points to a URL, for this node and every node below it */
|
|
33
|
-
disableUrlAccess?: boolean;
|
|
31
|
+
disableUrlAccess?: boolean | undefined;
|
|
34
32
|
}
|
|
35
33
|
/**
|
|
36
34
|
* An address object as accepted in address headers and produced by getAddresses. Either a
|
|
37
35
|
* mailbox with an address or a group holding a list of addresses
|
|
38
36
|
*/
|
|
39
37
|
export interface MimeNodeAddress {
|
|
40
|
-
name?: string;
|
|
41
|
-
address?: string;
|
|
42
|
-
group?: MimeNodeAddress[];
|
|
38
|
+
name?: string | undefined;
|
|
39
|
+
address?: string | undefined;
|
|
40
|
+
group?: MimeNodeAddress[] | undefined;
|
|
43
41
|
}
|
|
44
42
|
/**
|
|
45
43
|
* Addresses as accepted by address headers and envelope fields: an address string, an
|
|
@@ -52,8 +50,8 @@ export type MimeNodeAddressInput = string | MimeNodeAddress | MimeNodeAddressInp
|
|
|
52
50
|
*/
|
|
53
51
|
export interface MimeNodePreparedHeaderValue {
|
|
54
52
|
value?: unknown;
|
|
55
|
-
prepared?: boolean;
|
|
56
|
-
foldLines?: boolean;
|
|
53
|
+
prepared?: boolean | undefined;
|
|
54
|
+
foldLines?: boolean | undefined;
|
|
57
55
|
}
|
|
58
56
|
/**
|
|
59
57
|
* The values a header can hold: a string, a number, a Date (for the Date header), address
|
|
@@ -84,19 +82,15 @@ export type MimeNodeHeaders = MimeNodeHeader | MimeNodeHeader[] | MimeNodeHeader
|
|
|
84
82
|
*/
|
|
85
83
|
export interface MimeNodeContentObject {
|
|
86
84
|
/** File path to read the content from */
|
|
87
|
-
path?: string;
|
|
85
|
+
path?: string | undefined;
|
|
88
86
|
/** URL to fetch the content from */
|
|
89
|
-
href?: string;
|
|
87
|
+
href?: string | undefined;
|
|
90
88
|
/** Request headers for a URL fetch */
|
|
91
|
-
httpHeaders?: OutgoingHttpHeaders;
|
|
89
|
+
httpHeaders?: OutgoingHttpHeaders | undefined;
|
|
92
90
|
/** TLS settings for a URL fetch, see nmfetch */
|
|
93
91
|
tls?: {
|
|
94
92
|
[key: string]: any;
|
|
95
|
-
};
|
|
96
|
-
/** Read the content once and reuse the buffered value for every stream. MailComposer sets it on the icalEvent content, which is used twice */
|
|
97
|
-
_resolve?: boolean;
|
|
98
|
-
/** The buffered content once _resolve has run */
|
|
99
|
-
_resolvedValue?: Buffer;
|
|
93
|
+
} | undefined;
|
|
100
94
|
}
|
|
101
95
|
/**
|
|
102
96
|
* Body content as accepted by setContent and setRaw: a string, a Buffer, a readable stream
|
|
@@ -117,22 +111,22 @@ export interface MimeNodeEnvelope {
|
|
|
117
111
|
* other field is copied to the envelope as is
|
|
118
112
|
*/
|
|
119
113
|
export interface MimeNodeEnvelopeInput {
|
|
120
|
-
from?: MimeNodeAddressInput;
|
|
121
|
-
to?: MimeNodeAddressInput;
|
|
122
|
-
cc?: MimeNodeAddressInput;
|
|
123
|
-
bcc?: MimeNodeAddressInput;
|
|
114
|
+
from?: MimeNodeAddressInput | undefined;
|
|
115
|
+
to?: MimeNodeAddressInput | undefined;
|
|
116
|
+
cc?: MimeNodeAddressInput | undefined;
|
|
117
|
+
bcc?: MimeNodeAddressInput | undefined;
|
|
124
118
|
[key: string]: unknown;
|
|
125
119
|
}
|
|
126
120
|
/**
|
|
127
121
|
* Parsed address headers as returned by getAddresses, keyed by lowercase header name
|
|
128
122
|
*/
|
|
129
123
|
export interface MimeNodeAddresses {
|
|
130
|
-
from?: MimeNodeAddress[];
|
|
131
|
-
sender?: MimeNodeAddress[];
|
|
132
|
-
'reply-to'?: MimeNodeAddress[];
|
|
133
|
-
to?: MimeNodeAddress[];
|
|
134
|
-
cc?: MimeNodeAddress[];
|
|
135
|
-
bcc?: MimeNodeAddress[];
|
|
124
|
+
from?: MimeNodeAddress[] | undefined;
|
|
125
|
+
sender?: MimeNodeAddress[] | undefined;
|
|
126
|
+
'reply-to'?: MimeNodeAddress[] | undefined;
|
|
127
|
+
to?: MimeNodeAddress[] | undefined;
|
|
128
|
+
cc?: MimeNodeAddress[] | undefined;
|
|
129
|
+
bcc?: MimeNodeAddress[] | undefined;
|
|
136
130
|
}
|
|
137
131
|
/**
|
|
138
132
|
* Options for createReadStream. Handed to the PassThrough the message is written to and to
|
|
@@ -140,7 +134,7 @@ export interface MimeNodeAddresses {
|
|
|
140
134
|
*/
|
|
141
135
|
export interface MimeNodeStreamOptions extends TransformOptions {
|
|
142
136
|
/** Maximum line length for base64 and quoted-printable bodies, false disables wrapping */
|
|
143
|
-
lineLength?: number | false;
|
|
137
|
+
lineLength?: number | false | undefined;
|
|
144
138
|
}
|
|
145
139
|
/**
|
|
146
140
|
* A transform stream the message is piped through, or a function returning one
|
|
@@ -184,25 +178,16 @@ declare class MimeNode {
|
|
|
184
178
|
hostname: string | undefined;
|
|
185
179
|
newline: string | undefined;
|
|
186
180
|
childNodes: MimeNode[];
|
|
187
|
-
_nodeId: number;
|
|
188
|
-
_headers: MimeNodeHeader[];
|
|
189
|
-
_isPlainText: boolean;
|
|
190
|
-
_hasLongLines: boolean;
|
|
191
|
-
_envelope: MimeNodeEnvelope | false;
|
|
192
|
-
_raw: MimeNodeContent | Error | false;
|
|
193
|
-
_transforms: MimeNodeTransform[];
|
|
194
|
-
_processFuncs: MimeNodeProcessFunc[];
|
|
195
181
|
/** Filename for this node. Useful with attachments */
|
|
196
|
-
filename?: string;
|
|
182
|
+
filename?: string | undefined;
|
|
197
183
|
/** Body content, or the error a content stream emitted before it was read */
|
|
198
|
-
content?: MimeNodeContent | Error;
|
|
184
|
+
content?: MimeNodeContent | Error | undefined;
|
|
199
185
|
/** Lowercase content type, set when the headers are built */
|
|
200
|
-
contentType?: string;
|
|
186
|
+
contentType?: string | undefined;
|
|
201
187
|
/** Multipart subtype, false for a non-multipart node, set when the headers are built */
|
|
202
|
-
multipart?: string | false;
|
|
188
|
+
multipart?: string | false | undefined;
|
|
203
189
|
/** Multipart boundary, false for a non-multipart node, set when the headers are built */
|
|
204
|
-
boundary?: string | false;
|
|
205
|
-
_contentErrorHandler?: (err: Error) => void;
|
|
190
|
+
boundary?: string | false | undefined;
|
|
206
191
|
constructor(contentType?: string | false, options?: MimeNodeOptions);
|
|
207
192
|
/**
|
|
208
193
|
* Creates and appends a child node.Arguments provided are passed to MimeNode constructor
|
|
@@ -333,145 +318,6 @@ declare class MimeNode {
|
|
|
333
318
|
* @param raw Raw MIME contents
|
|
334
319
|
*/
|
|
335
320
|
setRaw(raw: MimeNodeContent): this;
|
|
336
|
-
/**
|
|
337
|
-
* Checks an access policy flag for this node and every node above it. The flags are set
|
|
338
|
-
* from the options the node was built with, and createChild only ever sees the options
|
|
339
|
-
* the caller passed, so a child of a closed tree starts out open. Reading the answer off
|
|
340
|
-
* the parent chain keeps it right whatever order the tree was assembled in.
|
|
341
|
-
*
|
|
342
|
-
* @param flag Either 'disableFileAccess' or 'disableUrlAccess'
|
|
343
|
-
* @return true if this node or an ancestor closed that access
|
|
344
|
-
*/
|
|
345
|
-
_accessDisabled(flag: 'disableFileAccess' | 'disableUrlAccess'): boolean;
|
|
346
|
-
/**
|
|
347
|
-
* Detects and returns handle to a stream related with the content.
|
|
348
|
-
*
|
|
349
|
-
* @param content Node content
|
|
350
|
-
* @returns Stream object
|
|
351
|
-
*/
|
|
352
|
-
_getStream(content: any): Readable;
|
|
353
|
-
/**
|
|
354
|
-
* Parses addresses. Takes in a single address or an array or an
|
|
355
|
-
* array of address arrays (eg. To: [[first group], [second group],...])
|
|
356
|
-
*
|
|
357
|
-
* @param addresses Addresses to be parsed
|
|
358
|
-
* @return An array of address objects
|
|
359
|
-
*/
|
|
360
|
-
_parseAddresses(addresses: MimeNodeAddressInput | undefined): MimeNodeAddress[];
|
|
361
|
-
/**
|
|
362
|
-
* Normalizes the addresses of a freshly parsed address list, groups included.
|
|
363
|
-
*
|
|
364
|
-
* Everything this method returns carries a normalized address, whether it arrived as an
|
|
365
|
-
* object or was parsed out of a header value. Without this the two shapes disagree, and
|
|
366
|
-
* a consumer reading the parsed form back is handed the ambiguous
|
|
367
|
-
* 'user@evil.com@good.com' that the header and the envelope no longer carry.
|
|
368
|
-
*
|
|
369
|
-
* @param parsed An array of address objects, as returned by addressparser
|
|
370
|
-
* @return The same array, with every address normalized
|
|
371
|
-
*/
|
|
372
|
-
_normalizeParsedAddresses(parsed: Address[]): Address[];
|
|
373
|
-
/**
|
|
374
|
-
* Parses the addresses of an explicitly set envelope.
|
|
375
|
-
*
|
|
376
|
-
* An envelope value is an addr-spec and never a display name, so a bare local username
|
|
377
|
-
* such as 'root' is the address here. Header parsing has to read the same value as a
|
|
378
|
-
* display name, as a value with no '@' in it can not be an addr-spec in a header.
|
|
379
|
-
*
|
|
380
|
-
* @param addresses Addresses to be parsed
|
|
381
|
-
* @return An array of address objects
|
|
382
|
-
*/
|
|
383
|
-
_parseEnvelopeAddresses(addresses: MimeNodeAddressInput | undefined): MimeNodeAddress[];
|
|
384
|
-
/**
|
|
385
|
-
* Normalizes a header key, uses Camel-Case form, except for uppercase MIME-
|
|
386
|
-
*
|
|
387
|
-
* @param key Key to be normalized
|
|
388
|
-
* @return key in Camel-Case form
|
|
389
|
-
*/
|
|
390
|
-
_normalizeHeaderKey(key: string): string;
|
|
391
|
-
/**
|
|
392
|
-
* Checks if the content type is multipart and defines boundary if needed.
|
|
393
|
-
* Doesn't return anything, modifies object argument instead.
|
|
394
|
-
*
|
|
395
|
-
* @param structured Parsed header value for 'Content-Type' key
|
|
396
|
-
*/
|
|
397
|
-
_handleContentType(structured: mimeFuncs.StructuredHeaderValue): void;
|
|
398
|
-
/**
|
|
399
|
-
* Generates a multipart boundary value
|
|
400
|
-
*
|
|
401
|
-
* @return boundary value
|
|
402
|
-
*/
|
|
403
|
-
_generateBoundary(): string;
|
|
404
|
-
/**
|
|
405
|
-
* Encodes a header value for use in the generated rfc2822 email.
|
|
406
|
-
*
|
|
407
|
-
* @param key Header key
|
|
408
|
-
* @param value Header value
|
|
409
|
-
*/
|
|
410
|
-
_encodeHeaderValue(key: string, value: MimeNodeHeaderValue): string;
|
|
411
|
-
/**
|
|
412
|
-
* Rebuilds address object using punycode and other adjustments
|
|
413
|
-
*
|
|
414
|
-
* @param addresses An array of address objects
|
|
415
|
-
* @param [uniqueList] An array to be populated with addresses
|
|
416
|
-
* @return address string
|
|
417
|
-
*/
|
|
418
|
-
_convertAddresses(addresses: MimeNodeAddress | MimeNodeAddress[] | undefined, uniqueList?: MimeNodeAddress[], seenAddresses?: Set<string>): string;
|
|
419
|
-
/**
|
|
420
|
-
* Normalizes an email address
|
|
421
|
-
*
|
|
422
|
-
* @param address An array of address objects
|
|
423
|
-
* @return address string
|
|
424
|
-
*/
|
|
425
|
-
_normalizeAddress(address?: string | false): string;
|
|
426
|
-
/**
|
|
427
|
-
* Normalizes the local part of an address into a form that can be emitted as is.
|
|
428
|
-
*
|
|
429
|
-
* A local part is either a dot-atom or a quoted-string, anything else is not a valid
|
|
430
|
-
* addr-spec. The quotes of a quoted local part get lost along the way, and a bare
|
|
431
|
-
* 'user@evil.com@good.com' leaves it to the receiver which '@' splits the domain off,
|
|
432
|
-
* while the split here is always at the last one. So whatever is not already one of
|
|
433
|
-
* the two valid forms goes back out as a quoted-string.
|
|
434
|
-
*
|
|
435
|
-
* @param user Local part of an address
|
|
436
|
-
* @return Local part as a dot-atom or as a quoted-string
|
|
437
|
-
*/
|
|
438
|
-
_normalizeLocalPart(user: string): string;
|
|
439
|
-
/**
|
|
440
|
-
* If needed, mime encodes the name part
|
|
441
|
-
*
|
|
442
|
-
* @param name Name part of an address
|
|
443
|
-
* @returns Mime word encoded string if needed
|
|
444
|
-
*/
|
|
445
|
-
_encodeAddressName(name: string): string;
|
|
446
|
-
/**
|
|
447
|
-
* Encodes an unstructured header value. Such a value can only carry VCHAR and WSP, so a
|
|
448
|
-
* control char or DEL has to be forced into the mime encoded word that a non-ascii value
|
|
449
|
-
* would get anyway. HT stays as it is, it is valid folding whitespace here.
|
|
450
|
-
*
|
|
451
|
-
* @param value Header value to encode
|
|
452
|
-
* @returns Mime word encoded string if needed
|
|
453
|
-
*/
|
|
454
|
-
_encodeHeaderText(value: string): string;
|
|
455
|
-
/**
|
|
456
|
-
* If needed, mime encodes the name part
|
|
457
|
-
*
|
|
458
|
-
* @param name Name part of an address
|
|
459
|
-
* @returns Mime word encoded string if needed
|
|
460
|
-
*/
|
|
461
|
-
_encodeWords(value: string): string;
|
|
462
|
-
/**
|
|
463
|
-
* Detects best mime encoding for a text value
|
|
464
|
-
*
|
|
465
|
-
* @param value Value to check for
|
|
466
|
-
* @return either 'Q' or 'B'
|
|
467
|
-
*/
|
|
468
|
-
_getTextEncoding(value?: string | Buffer): string;
|
|
469
|
-
/**
|
|
470
|
-
* Generates a message id
|
|
471
|
-
*
|
|
472
|
-
* @return Random Message-ID value
|
|
473
|
-
*/
|
|
474
|
-
_generateMessageId(): string;
|
|
475
321
|
}
|
|
476
322
|
/**
|
|
477
323
|
* Type aliases in the layout of @types/nodemailer, so `MimeNode.Options` style references keep working
|