@types/nodemailer 6.4.0 → 6.4.4

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.
nodemailer/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
nodemailer/README.md CHANGED
@@ -8,9 +8,9 @@ This package contains type definitions for Nodemailer (https://github.com/nodema
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 18 Dec 2019 16:21:54 GMT
11
+ * Last updated: Thu, 08 Jul 2021 18:51:33 GMT
12
12
  * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
13
13
  * Global values: none
14
14
 
15
15
  # Credits
16
- These definitions were written by Rogier Schouten (https://github.com/rogierschouten), Piotr Roszatycki (https://github.com/dex4er), and Daniel Chao (https://github.com/bioball).
16
+ These definitions were written by [Rogier Schouten](https://github.com/rogierschouten), [Piotr Roszatycki](https://github.com/dex4er), and [Daniel Chao](https://github.com/bioball).
nodemailer/index.d.ts CHANGED
@@ -19,17 +19,17 @@ import StreamTransport = require('./lib/stream-transport');
19
19
 
20
20
  export type SendMailOptions = Mail.Options;
21
21
 
22
- export type SentMessageInfo = any;
22
+ export type Transporter<T = any> = Mail<T>;
23
23
 
24
- export type Transporter = Mail;
24
+ export type SentMessageInfo = any;
25
25
 
26
- export interface Transport {
27
- mailer?: Mail;
26
+ export interface Transport<T = any> {
27
+ mailer?: Transporter<T> | undefined;
28
28
 
29
29
  name: string;
30
30
  version: string;
31
31
 
32
- send(mail: MailMessage, callback: (err: Error | null, info: SentMessageInfo) => void): void;
32
+ send(mail: MailMessage<T>, callback: (err: Error | null, info: T) => void): void;
33
33
 
34
34
  verify?(callback: (err: Error | null, success: true) => void): void;
35
35
  verify?(): Promise<true>;
@@ -38,27 +38,45 @@ export interface Transport {
38
38
  }
39
39
 
40
40
  export interface TransportOptions {
41
- component?: string;
41
+ component?: string | undefined;
42
42
  }
43
43
 
44
44
  export interface TestAccount {
45
45
  user: string;
46
46
  pass: string;
47
- smtp: { host: string, port: number, secure: boolean };
48
- imap: { host: string, port: number, secure: boolean };
49
- pop3: { host: string, port: number, secure: boolean };
47
+ smtp: { host: string; port: number; secure: boolean };
48
+ imap: { host: string; port: number; secure: boolean };
49
+ pop3: { host: string; port: number; secure: boolean };
50
50
  web: string;
51
51
  }
52
52
 
53
- export function createTransport(transport?: SMTPTransport | SMTPTransport.Options | string, defaults?: SMTPTransport.Options): Mail;
54
- export function createTransport(transport: SMTPPool | SMTPPool.Options, defaults?: SMTPPool.Options): Mail;
55
- export function createTransport(transport: SendmailTransport | SendmailTransport.Options, defaults?: SendmailTransport.Options): Mail;
56
- export function createTransport(transport: StreamTransport | StreamTransport.Options, defaults?: StreamTransport.Options): Mail;
57
- export function createTransport(transport: JSONTransport | JSONTransport.Options, defaults?: JSONTransport.Options): Mail;
58
- export function createTransport(transport: SESTransport | SESTransport.Options, defaults?: SESTransport.Options): Mail;
59
- export function createTransport(transport: Transport | TransportOptions, defaults?: TransportOptions): Mail;
53
+ export function createTransport(
54
+ transport?: SMTPTransport | SMTPTransport.Options | string,
55
+ defaults?: SMTPTransport.Options,
56
+ ): Transporter<SMTPTransport.SentMessageInfo>;
57
+ export function createTransport(transport: SMTPPool | SMTPPool.Options, defaults?: SMTPPool.Options): Transporter<SMTPPool.SentMessageInfo>;
58
+ export function createTransport(
59
+ transport: SendmailTransport | SendmailTransport.Options,
60
+ defaults?: SendmailTransport.Options,
61
+ ): Transporter<SendmailTransport.SentMessageInfo>;
62
+ export function createTransport(
63
+ transport: StreamTransport | StreamTransport.Options,
64
+ defaults?: StreamTransport.Options,
65
+ ): Transporter<StreamTransport.SentMessageInfo>;
66
+ export function createTransport(
67
+ transport: JSONTransport | JSONTransport.Options,
68
+ defaults?: JSONTransport.Options,
69
+ ): Transporter<JSONTransport.SentMessageInfo>;
70
+ export function createTransport(
71
+ transport: SESTransport | SESTransport.Options,
72
+ defaults?: SESTransport.Options,
73
+ ): Transporter<SESTransport.SentMessageInfo>;
74
+ export function createTransport<T>(transport: Transport<T> | TransportOptions, defaults?: TransportOptions): Transporter<T>;
60
75
 
61
- export function createTestAccount(apiUrl: string, callback: (err: Error | null, testAccount: TestAccount) => void): void;
76
+ export function createTestAccount(
77
+ apiUrl: string,
78
+ callback: (err: Error | null, testAccount: TestAccount) => void,
79
+ ): void;
62
80
  export function createTestAccount(callback: (err: Error | null, testAccount: TestAccount) => void): void;
63
81
  export function createTestAccount(apiUrl?: string): Promise<TestAccount>;
64
82
 
File without changes
@@ -9,7 +9,7 @@ export function encode(buffer: Buffer | string): string;
9
9
  export function wrap(str: string, lineLength?: number): string;
10
10
 
11
11
  export interface EncoderOptions extends TransformOptions {
12
- lineLength?: number | false;
12
+ lineLength?: number | false | undefined;
13
13
  }
14
14
 
15
15
  export class Encoder extends Transform {
@@ -5,15 +5,15 @@ import { PassThrough, Readable } from 'stream';
5
5
  declare namespace DKIM {
6
6
  interface OptionalOptions {
7
7
  /** optional location for cached messages. If not set then caching is not used. */
8
- cacheDir?: string | false;
8
+ cacheDir?: string | false | undefined;
9
9
  /** optional size in bytes, if message is larger than this treshold it gets cached to disk (assuming cacheDir is set and writable). Defaults to 131072 (128 kB). */
10
- cacheTreshold?: number;
10
+ cacheTreshold?: number | undefined;
11
11
  /** optional algorithm for the body hash, defaults to ‘sha256’ */
12
- hashAlgo?: string;
12
+ hashAlgo?: string | undefined;
13
13
  /** an optional colon separated list of header keys to sign (eg. message-id:date:from:to...') */
14
- headerFieldNames?: string;
14
+ headerFieldNames?: string | undefined;
15
15
  /** optional colon separated list of header keys not to sign. This is useful if you want to sign all the relevant keys but your provider changes some values, ie Message-ID and Date. In this case you should use 'message-id:date' to prevent signing these values. */
16
- skipFields?: string;
16
+ skipFields?: string | undefined;
17
17
  }
18
18
 
19
19
  interface SingleKeyOptions extends OptionalOptions {
File without changes
File without changes
File without changes
@@ -3,16 +3,16 @@ type s = number;
3
3
  declare namespace Cookies {
4
4
  interface Cookie {
5
5
  name: string;
6
- value?: string;
7
- expires?: Date;
8
- path?: string;
9
- domain?: string;
10
- secure?: boolean;
11
- httponly?: boolean;
6
+ value?: string | undefined;
7
+ expires?: Date | undefined;
8
+ path?: string | undefined;
9
+ domain?: string | undefined;
10
+ secure?: boolean | undefined;
11
+ httponly?: boolean | undefined;
12
12
  }
13
13
 
14
14
  interface Options {
15
- sessionTimeout?: s;
15
+ sessionTimeout?: s | undefined;
16
16
  }
17
17
  }
18
18
 
@@ -17,19 +17,19 @@ declare namespace fetch {
17
17
  }
18
18
 
19
19
  interface Options {
20
- fetchRes?: Writable;
21
- cookies?: Cookies;
22
- cookie?: string;
23
- redirects?: number;
24
- maxRedirects?: number;
25
- method?: string;
26
- headers?: { [key: string]: string };
27
- userAgent?: string;
28
- body?: Buffer | string | { [key: string]: string };
29
- contentType?: string | false;
30
- tls?: tls.TlsOptions;
31
- timeout?: ms;
32
- allowErrorResponse?: boolean;
20
+ fetchRes?: Writable | undefined;
21
+ cookies?: Cookies | undefined;
22
+ cookie?: string | undefined;
23
+ redirects?: number | undefined;
24
+ maxRedirects?: number | undefined;
25
+ method?: string | undefined;
26
+ headers?: { [key: string]: string } | undefined;
27
+ userAgent?: string | undefined;
28
+ body?: Buffer | string | { [key: string]: string } | undefined;
29
+ contentType?: string | false | undefined;
30
+ tls?: tls.TlsOptions | undefined;
31
+ timeout?: ms | undefined;
32
+ allowErrorResponse?: boolean | undefined;
33
33
  }
34
34
  }
35
35
 
@@ -15,7 +15,7 @@ declare namespace JSONTransport {
15
15
 
16
16
  interface Options extends MailOptions, TransportOptions {
17
17
  jsonTransport: true;
18
- skipEncoding?: boolean;
18
+ skipEncoding?: boolean | undefined;
19
19
  }
20
20
 
21
21
  interface SentMessageInfo {
@@ -25,14 +25,18 @@ declare namespace JSONTransport {
25
25
  messageId: string;
26
26
  /** JSON string */
27
27
  message: string;
28
+ accepted: Array<string | Mail.Address>;
29
+ rejected: Array<string | Mail.Address>;
30
+ pending: Array<string | Mail.Address>;
31
+ response: string;
28
32
  }
29
33
  }
30
34
 
31
- declare class JSONTransport implements Transport {
35
+ declare class JSONTransport implements Transport<JSONTransport.SentMessageInfo> {
32
36
  options: JSONTransport.Options;
33
37
 
34
38
  logger: shared.Logger;
35
- mailer: Mail;
39
+ mailer: Mail<JSONTransport.SentMessageInfo>;
36
40
 
37
41
  name: string;
38
42
  version: string;
@@ -40,7 +44,7 @@ declare class JSONTransport implements Transport {
40
44
  constructor(options: JSONTransport.Options);
41
45
 
42
46
  /** Compiles a mailcomposer message and forwards it to handler that sends it */
43
- send(mail: MailMessage, callback: (err: Error | null, info: JSONTransport.SentMessageInfo) => void): void;
47
+ send(mail: MailMessage<JSONTransport.SentMessageInfo>, callback: (err: Error | null, info: JSONTransport.SentMessageInfo) => void): void;
44
48
  }
45
49
 
46
50
  export = JSONTransport;
File without changes
@@ -5,7 +5,7 @@ import { Socket } from 'net';
5
5
  import { Readable } from 'stream';
6
6
  import { Url } from 'url';
7
7
 
8
- import { SentMessageInfo, Transport, TransportOptions } from '../..';
8
+ import { Transport, TransportOptions } from '../..';
9
9
  import * as shared from '../shared';
10
10
 
11
11
  import DKIM = require('../dkim');
@@ -32,50 +32,50 @@ declare namespace Mail {
32
32
 
33
33
  interface AttachmentLike {
34
34
  /** String, Buffer or a Stream contents for the attachmentent */
35
- content?: string | Buffer | Readable;
35
+ content?: string | Buffer | Readable | undefined;
36
36
  /** path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments) */
37
- path?: string | Url;
37
+ path?: string | Url | undefined;
38
38
  }
39
39
 
40
40
  interface Attachment extends AttachmentLike {
41
41
  /** filename to be reported as the name of the attached file, use of unicode is allowed. If you do not want to use a filename, set this value as false, otherwise a filename is generated automatically */
42
- filename?: string | false;
42
+ filename?: string | false | undefined;
43
43
  /** optional content id for using inline images in HTML message source. Using cid sets the default contentDisposition to 'inline' and moves the attachment into a multipart/related mime node, so use it only if you actually want to use this attachment as an embedded image */
44
- cid?: string;
44
+ cid?: string | undefined;
45
45
  /** If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, binary etc. Useful if you want to use binary attachments in a JSON formatted e-mail object */
46
- encoding?: string;
46
+ encoding?: string | undefined;
47
47
  /** optional content type for the attachment, if not set will be derived from the filename property */
48
- contentType?: string;
48
+ contentType?: string | undefined;
49
49
  /** optional transfer encoding for the attachment, if not set it will be derived from the contentType property. Example values: quoted-printable, base64. If it is unset then base64 encoding is used for the attachment. If it is set to false then previous default applies (base64 for most, 7bit for text). */
50
- contentTransferEncoding?: '7bit' | 'base64' | 'quoted-printable' | false;
50
+ contentTransferEncoding?: '7bit' | 'base64' | 'quoted-printable' | false | undefined;
51
51
  /** optional content disposition type for the attachment, defaults to ‘attachment’ */
52
- contentDisposition?: 'attachment' | 'inline';
52
+ contentDisposition?: 'attachment' | 'inline' | undefined;
53
53
  /** is an object of additional headers */
54
- headers?: Headers;
54
+ headers?: Headers | undefined;
55
55
  /** an optional value that overrides entire node content in the mime message. If used then all other options set for this node are ignored. */
56
- raw?: string | Buffer | Readable | AttachmentLike;
56
+ raw?: string | Buffer | Readable | AttachmentLike | undefined;
57
57
  }
58
58
 
59
59
  interface AmpAttachment extends AttachmentLike {
60
60
  /** is an alternative for content to load the AMP4EMAIL data from an URL */
61
- href?: string;
61
+ href?: string | undefined;
62
62
  /** defines optional content encoding, eg. ‘base64’ or ‘hex’. This only applies if the content is a string. By default an unicode string is assumed. */
63
- encoding?: string;
63
+ encoding?: string | undefined;
64
64
  /** optional content type for the attachment, if not set will be derived from the filename property */
65
- contentType?: string;
65
+ contentType?: string | undefined;
66
66
  /** an optional value that overrides entire node content in the mime message. If used then all other options set for this node are ignored. */
67
- raw?: string | Buffer | Readable | AttachmentLike;
67
+ raw?: string | Buffer | Readable | AttachmentLike | undefined;
68
68
  }
69
69
 
70
70
  interface IcalAttachment extends AttachmentLike {
71
71
  /** optional method, case insensitive, defaults to ‘publish’. Other possible values would be ‘request’, ‘reply’, ‘cancel’ or any other valid calendar method listed in RFC5546. This should match the METHOD: value in calendar event file. */
72
- method?: string;
72
+ method?: string | undefined;
73
73
  /** optional filename, defaults to ‘invite.ics’ */
74
- filename?: string | false;
74
+ filename?: string | false | undefined;
75
75
  /** is an alternative for content to load the calendar data from an URL */
76
- href?: string;
76
+ href?: string | undefined;
77
77
  /** defines optional content encoding, eg. ‘base64’ or ‘hex’. This only applies if the content is a string. By default an unicode string is assumed. */
78
- encoding?: string;
78
+ encoding?: string | undefined;
79
79
  }
80
80
 
81
81
  interface Connection {
@@ -84,90 +84,90 @@ declare namespace Mail {
84
84
 
85
85
  interface Envelope {
86
86
  /** the first address gets used as MAIL FROM address in SMTP */
87
- from?: string;
87
+ from?: string | undefined;
88
88
  /** addresses from this value get added to RCPT TO list */
89
- to?: string;
89
+ to?: string | undefined;
90
90
  /** addresses from this value get added to RCPT TO list */
91
- cc?: string;
91
+ cc?: string | undefined;
92
92
  /** addresses from this value get added to RCPT TO list */
93
- bcc?: string;
93
+ bcc?: string | undefined;
94
94
  }
95
95
 
96
96
  interface Options {
97
97
  /** The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name <sender@server.com>' */
98
- from?: string | Address;
98
+ from?: string | Address | undefined;
99
99
  /** An e-mail address that will appear on the Sender: field */
100
- sender?: string | Address;
100
+ sender?: string | Address | undefined;
101
101
  /** Comma separated list or an array of recipients e-mail addresses that will appear on the To: field */
102
- to?: string | Address | Array<string | Address>;
102
+ to?: string | Address | Array<string | Address> | undefined;
103
103
  /** Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field */
104
- cc?: string | Address | Array<string | Address>;
104
+ cc?: string | Address | Array<string | Address> | undefined;
105
105
  /** Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field */
106
- bcc?: string | Address | Array<string | Address>;
106
+ bcc?: string | Address | Array<string | Address> | undefined;
107
107
  /** An e-mail address that will appear on the Reply-To: field */
108
- replyTo?: string | Address;
108
+ replyTo?: string | Address | undefined;
109
109
  /** The message-id this message is replying */
110
- inReplyTo?: string | Address;
110
+ inReplyTo?: string | Address | undefined;
111
111
  /** Message-id list (an array or space separated string) */
112
- references?: string | string[];
112
+ references?: string | string[] | undefined;
113
113
  /** The subject of the e-mail */
114
- subject?: string;
114
+ subject?: string | undefined;
115
115
  /** The plaintext version of the message */
116
- text?: string | Buffer | Readable | AttachmentLike;
116
+ text?: string | Buffer | Readable | AttachmentLike | undefined;
117
117
  /** The HTML version of the message */
118
- html?: string | Buffer | Readable | AttachmentLike;
118
+ html?: string | Buffer | Readable | AttachmentLike | undefined;
119
119
  /** Apple Watch specific HTML version of the message, same usage as with text and html */
120
- watchHtml?: string | Buffer | Readable | AttachmentLike;
120
+ watchHtml?: string | Buffer | Readable | AttachmentLike | undefined;
121
121
  /** AMP4EMAIL specific HTML version of the message, same usage as with text and html. Make sure it is a full and valid AMP4EMAIL document, otherwise the displaying email client falls back to html and ignores the amp part */
122
- amp?: string | Buffer | Readable | AmpAttachment;
122
+ amp?: string | Buffer | Readable | AmpAttachment | undefined;
123
123
  /** iCalendar event, same usage as with text and html. Event method attribute defaults to ‘PUBLISH’ or define it yourself: {method: 'REQUEST', content: iCalString}. This value is added as an additional alternative to html or text. Only utf-8 content is allowed */
124
- icalEvent?: string | Buffer | Readable | IcalAttachment;
124
+ icalEvent?: string | Buffer | Readable | IcalAttachment | undefined;
125
125
  /** An object or array of additional header fields */
126
- headers?: Headers;
126
+ headers?: Headers | undefined;
127
127
  /** An object where key names are converted into list headers. List key help becomes List-Help header etc. */
128
- list?: ListHeaders;
128
+ list?: ListHeaders | undefined;
129
129
  /** An array of attachment objects */
130
- attachments?: Attachment[];
130
+ attachments?: Attachment[] | undefined;
131
131
  /** An array of alternative text contents (in addition to text and html parts) */
132
- alternatives?: Attachment[];
132
+ alternatives?: Attachment[] | undefined;
133
133
  /** optional SMTP envelope, if auto generated envelope is not suitable */
134
- envelope?: Envelope | MimeNode.Envelope;
134
+ envelope?: Envelope | MimeNode.Envelope | undefined;
135
135
  /** optional Message-Id value, random value will be generated if not set */
136
- messageId?: string;
136
+ messageId?: string | undefined;
137
137
  /** optional Date value, current UTC string will be used if not set */
138
- date?: Date | string;
138
+ date?: Date | string | undefined;
139
139
  /** optional transfer encoding for the textual parts */
140
- encoding?: string;
140
+ encoding?: string | undefined;
141
141
  /** if set then overwrites entire message output with this value. The value is not parsed, so you should still set address headers or the envelope value for the message to work */
142
- raw?: string | Buffer | Readable | AttachmentLike;
142
+ raw?: string | Buffer | Readable | AttachmentLike | undefined;
143
143
  /** set explicitly which encoding to use for text parts (quoted-printable or base64). If not set then encoding is detected from text content (mostly ascii means quoted-printable, otherwise base64) */
144
- textEncoding?: TextEncoding;
144
+ textEncoding?: TextEncoding | undefined;
145
145
  /** if set to true then fails with an error when a node tries to load content from URL */
146
- disableUrlAccess?: boolean;
146
+ disableUrlAccess?: boolean | undefined;
147
147
  /** if set to true then fails with an error when a node tries to load content from a file */
148
- disableFileAccess?: boolean;
148
+ disableFileAccess?: boolean | undefined;
149
149
  /** is an object with DKIM options */
150
- dkim?: DKIM.Options;
150
+ dkim?: DKIM.Options | undefined;
151
151
  /** method to normalize header keys for custom caseing */
152
152
  normalizeHeaderKey?(key: string): string;
153
- priority?: "high"|"normal"|"low";
153
+ priority?: "high"|"normal"|"low" | undefined;
154
154
  }
155
155
 
156
- type PluginFunction = (mail: MailMessage, callback: (err?: Error | null) => void) => void;
156
+ type PluginFunction<T = any> = (mail: MailMessage<T>, callback: (err?: Error | null) => void) => void;
157
157
  }
158
158
 
159
159
  /** Creates an object for exposing the Mail API */
160
- declare class Mail extends EventEmitter {
160
+ declare class Mail<T = any> extends EventEmitter {
161
161
  options: Mail.Options;
162
162
  meta: Map<string, any>;
163
163
  dkim: DKIM;
164
- transporter: Transport;
164
+ transporter: Transport<T>;
165
165
  logger: shared.Logger;
166
166
 
167
167
  /** Usage: typeof transporter.MailMessage */
168
- MailMessage: MailMessage;
168
+ MailMessage: MailMessage<T>;
169
169
 
170
- constructor(transporter: Transport, options?: TransportOptions, defaults?: TransportOptions);
170
+ constructor(transporter: Transport<T>, options?: TransportOptions, defaults?: TransportOptions);
171
171
 
172
172
  /** Closes all connections in the pool. If there is a message being sent, the connection is closed later */
173
173
  close(): void;
@@ -179,11 +179,11 @@ declare class Mail extends EventEmitter {
179
179
  verify(callback: (err: Error | null, success: true) => void): void;
180
180
  verify(): Promise<true>;
181
181
 
182
- use(step: string, plugin: Mail.PluginFunction): this;
182
+ use(step: string, plugin: Mail.PluginFunction<T>): this;
183
183
 
184
184
  /** Sends an email using the preselected transport object */
185
- sendMail(mailOptions: Mail.Options, callback: (err: Error | null, info: SentMessageInfo) => void): void;
186
- sendMail(mailOptions: Mail.Options): Promise<SentMessageInfo>;
185
+ sendMail(mailOptions: Mail.Options, callback: (err: Error | null, info: T) => void): void;
186
+ sendMail(mailOptions: Mail.Options): Promise<T>;
187
187
 
188
188
  getVersionString(): string;
189
189
 
@@ -5,12 +5,12 @@ import { Readable } from 'stream';
5
5
  import Mail = require('.');
6
6
  import MimeNode = require('../mime-node');
7
7
 
8
- declare class MailMessage {
9
- mailer: Mail;
8
+ declare class MailMessage<T = any> {
9
+ mailer: Mail<T>;
10
10
  data: Mail.Options;
11
11
  message: MimeNode;
12
12
 
13
- constructor(mailer: Mail, data: Mail.Options);
13
+ constructor(mailer: Mail<T>, data: Mail.Options);
14
14
 
15
15
  resolveContent(data: object | any[], key: string | number, callback: (err: Error | null, value?: any) => any): Promise<any>;
16
16
 
@@ -1,6 +1,6 @@
1
1
  export interface HeaderValue {
2
2
  value: string;
3
- params?: { [key: string]: string };
3
+ params?: { [key: string]: string } | undefined;
4
4
  }
5
5
 
6
6
  export interface ParsedHeaderValue extends HeaderValue {
File without changes
@@ -7,12 +7,12 @@ import SMTPConnection = require('../smtp-connection');
7
7
 
8
8
  declare namespace MimeNode {
9
9
  interface Addresses {
10
- from?: string[];
11
- sender?: string[];
12
- 'reply-to'?: string[];
13
- to?: string[];
14
- cc?: string[];
15
- bcc?: string[];
10
+ from?: string[] | undefined;
11
+ sender?: string[] | undefined;
12
+ 'reply-to'?: string[] | undefined;
13
+ to?: string[] | undefined;
14
+ cc?: string[] | undefined;
15
+ bcc?: string[] | undefined;
16
16
  }
17
17
 
18
18
  interface Envelope {
@@ -24,17 +24,17 @@ declare namespace MimeNode {
24
24
 
25
25
  interface Options {
26
26
  /** root node for this tree */
27
- rootNode?: MimeNode;
27
+ rootNode?: MimeNode | undefined;
28
28
  /** immediate parent for this node */
29
- parentNode?: MimeNode;
29
+ parentNode?: MimeNode | undefined;
30
30
  /** filename for an attachment node */
31
- filename?: string;
31
+ filename?: string | undefined;
32
32
  /** shared part of the unique multipart boundary */
33
- baseBoundary?: string;
33
+ baseBoundary?: string | undefined;
34
34
  /** If true, do not exclude Bcc from the generated headers */
35
- keepBcc?: boolean;
35
+ keepBcc?: boolean | undefined;
36
36
  /** either 'Q' (the default) or 'B' */
37
- textEncoding?: 'B' | 'Q';
37
+ textEncoding?: 'B' | 'Q' | undefined;
38
38
  /** method to normalize header keys for custom caseing */
39
39
  normalizeHeaderKey?(key: string): string;
40
40
  }
File without changes
nodemailer/lib/qp.d.ts CHANGED
@@ -9,7 +9,7 @@ export function encode(buffer: Buffer | string): string;
9
9
  export function wrap(str: string, lineLength?: number): string;
10
10
 
11
11
  export interface EncoderOptions extends TransformOptions {
12
- lineLength?: number | false;
12
+ lineLength?: number | false | undefined;
13
13
  }
14
14
 
15
15
  /** Creates a transform stream for encoding data to Quoted-Printable encoding */
@@ -14,24 +14,27 @@ declare namespace SendmailTransport {
14
14
  interface Options extends MailOptions, TransportOptions {
15
15
  sendmail: true;
16
16
  /** path to the sendmail command (defaults to ‘sendmail’) */
17
- path?: string;
17
+ path?: string | undefined;
18
18
  /** either ‘windows’ or ‘unix’ (default). Forces all newlines in the output to either use Windows syntax <CR><LF> or Unix syntax <LF> */
19
- newline?: string;
19
+ newline?: string | undefined;
20
20
  /** an optional array of command line options to pass to the sendmail command (ie. ["-f", "foo@blurdybloop.com"]). This overrides all default arguments except for ’-i’ and recipient list so you need to make sure you have all required arguments set (ie. the ‘-f’ flag). */
21
- args?: string[];
21
+ args?: string[] | undefined;
22
22
  }
23
23
 
24
24
  interface SentMessageInfo {
25
25
  envelope: MimeNode.Envelope;
26
26
  messageId: string;
27
27
  response: string;
28
+ accepted: Array<string | Mail.Address>;
29
+ rejected: Array<string | Mail.Address>;
30
+ pending: Array<string | Mail.Address>;
28
31
  }
29
32
  }
30
33
 
31
- declare class SendmailTransport implements Transport {
34
+ declare class SendmailTransport implements Transport<SendmailTransport.SentMessageInfo> {
32
35
  options: SendmailTransport.Options;
33
36
  logger: shared.Logger;
34
- mailer: Mail;
37
+ mailer: Mail<SendmailTransport.SentMessageInfo>;
35
38
  name: string;
36
39
  version: string;
37
40
  path: string;
@@ -41,7 +44,10 @@ declare class SendmailTransport implements Transport {
41
44
  constructor(options: SendmailTransport.Options);
42
45
 
43
46
  /** Compiles a mailcomposer message and forwards it to handler that sends it */
44
- send(mail: MailMessage, callback: (err: Error | null, info: SendmailTransport.SentMessageInfo) => void): void;
47
+ send(
48
+ mail: MailMessage<SendmailTransport.SentMessageInfo>,
49
+ callback: (err: Error | null, info: SendmailTransport.SentMessageInfo) => void,
50
+ ): void;
45
51
  }
46
52
 
47
53
  export = SendmailTransport;
File without changes
File without changes
@@ -13,18 +13,18 @@ import MimeNode = require('./mime-node');
13
13
  declare namespace SESTransport {
14
14
  interface MailOptions extends Mail.Options {
15
15
  /** list of keys that SendRawEmail method can take */
16
- ses?: MailSesOptions;
16
+ ses?: MailSesOptions | undefined;
17
17
  }
18
18
 
19
19
  interface MailSesOptions {
20
20
  /**
21
21
  * The identity's email address. If you do not provide a value for this parameter, you must specify a "From" address in the raw text of the message. (You can also specify both.) Amazon SES does not support the SMTPUTF8 extension, as described inRFC6531. For this reason, the local part of a source email address (the part of the email address that precedes the @ sign) may only contain 7-bit ASCII characters. If the domain part of an address (the part after the @ sign) contains non-ASCII characters, they must be encoded using Punycode, as described in RFC3492. The sender name (also known as the friendly name) may contain non-ASCII characters. These characters must be encoded using MIME encoded-word syntax, as described in RFC 2047. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=. If you specify the Source parameter and have feedback forwarding enabled, then bounces and complaints will be sent to this email address. This takes precedence over any Return-Path header that you might include in the raw text of the message.
22
22
  */
23
- Source?: string;
23
+ Source?: string | undefined;
24
24
  /**
25
25
  * A list of destinations for the message, consisting of To:, CC:, and BCC: addresses.
26
26
  */
27
- Destinations?: string[];
27
+ Destinations?: string[] | undefined;
28
28
  /**
29
29
  * The raw email message itself. The message has to meet the following criteria: The message has to contain a header and a body, separated by a blank line. All of the required header fields must be present in the message. Each part of a multipart MIME message must be formatted properly. Attachments must be of a content type that Amazon SES supports. For a list on unsupported content types, see Unsupported Attachment Types in the Amazon SES Developer Guide. The entire message must be base64-encoded. If any of the MIME parts in your message contain content that is outside of the 7-bit ASCII character range, we highly recommend that you encode that content. For more information, see Sending Raw Email in the Amazon SES Developer Guide. Per RFC 5321, the maximum length of each line of text, including the &lt;CRLF&gt;, must not exceed 1,000 characters.
30
30
  */
@@ -33,19 +33,19 @@ declare namespace SESTransport {
33
33
  * The raw data of the message. This data needs to base64-encoded if you are accessing Amazon SES directly through the HTTPS interface. If you are accessing Amazon SES using an AWS SDK, the SDK takes care of the base 64-encoding for you. In all cases, the client must ensure that the message format complies with Internet email standards regarding email header fields, MIME types, and MIME encoding. The To:, CC:, and BCC: headers in the raw message can contain a group list. If you are using SendRawEmail with sending authorization, you can include X-headers in the raw message to specify the "Source," "From," and "Return-Path" addresses. For more information, see the documentation for SendRawEmail. Do not include these X-headers in the DKIM signature, because they are removed by Amazon SES before sending the email. For more information, go to the Amazon SES Developer Guide.
34
34
  */
35
35
  Data: Buffer|Uint8Array|{}|string;
36
- };
36
+ } | undefined;
37
37
  /**
38
38
  * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to specify a particular "From" address in the header of the raw email. Instead of using this parameter, you can use the X-header X-SES-FROM-ARN in the raw message of the email. If you use both the FromArn parameter and the corresponding X-header, Amazon SES uses the value of the FromArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
39
39
  */
40
- FromArn?: string;
40
+ FromArn?: string | undefined;
41
41
  /**
42
42
  * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter. For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to send from user@example.com, then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the Source to be user@example.com. Instead of using this parameter, you can use the X-header X-SES-SOURCE-ARN in the raw message of the email. If you use both the SourceArn parameter and the corresponding X-header, Amazon SES uses the value of the SourceArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
43
43
  */
44
- SourceArn?: string;
44
+ SourceArn?: string | undefined;
45
45
  /**
46
46
  * This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter. For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com) attaches a policy to it that authorizes you to use feedback@example.com, then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com, and the ReturnPath to be feedback@example.com. Instead of using this parameter, you can use the X-header X-SES-RETURN-PATH-ARN in the raw message of the email. If you use both the ReturnPathArn parameter and the corresponding X-header, Amazon SES uses the value of the ReturnPathArn parameter. For information about when to use this parameter, see the description of SendRawEmail in this guide, or see the Amazon SES Developer Guide.
47
47
  */
48
- ReturnPathArn?: string;
48
+ ReturnPathArn?: string | undefined;
49
49
  /**
50
50
  * A list of tags, in the form of name/value pairs, to apply to an email that you send using SendRawEmail. Tags correspond to characteristics of the email that you define, so that you can publish email sending events.
51
51
  */
@@ -58,20 +58,20 @@ declare namespace SESTransport {
58
58
  * The value of the tag. The value must: This value can only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). Contain less than 256 characters.
59
59
  */
60
60
  Value: string;
61
- }>;
61
+ }> | undefined;
62
62
  /**
63
63
  * The name of the configuration set to use when you send an email using SendRawEmail.
64
64
  */
65
- ConfigurationSetName?: string;
65
+ ConfigurationSetName?: string | undefined;
66
66
  }
67
67
 
68
68
  interface Options extends MailOptions, TransportOptions {
69
69
  /** is an option that expects an instantiated aws.SES object */
70
70
  SES: any; // aws-sdk.SES object
71
71
  /** How many messages per second is allowed to be delivered to SES */
72
- maxConnections?: number;
72
+ maxConnections?: number | undefined;
73
73
  /** How many parallel connections to allow towards SES */
74
- sendingRate?: number;
74
+ sendingRate?: number | undefined;
75
75
  }
76
76
 
77
77
  interface SentMessageInfo {
@@ -80,14 +80,17 @@ declare namespace SESTransport {
80
80
  /** the Message-ID header value. This value is derived from the response of SES API, so it differs from the Message-ID values used in logging. */
81
81
  messageId: string;
82
82
  response: string;
83
+ accepted: Array<string | Mail.Address>;
84
+ rejected: Array<string | Mail.Address>;
85
+ pending: Array<string | Mail.Address>;
83
86
  }
84
87
  }
85
88
 
86
- declare class SESTransport extends EventEmitter implements Transport {
89
+ declare class SESTransport extends EventEmitter implements Transport<SESTransport.SentMessageInfo> {
87
90
  options: SESTransport.Options;
88
91
 
89
92
  logger: shared.Logger;
90
- mailer: Mail;
93
+ mailer: Mail<SESTransport.SentMessageInfo>;
91
94
 
92
95
  name: string;
93
96
  version: string;
@@ -100,13 +103,13 @@ declare class SESTransport extends EventEmitter implements Transport {
100
103
  sendingRateTTL: number | null;
101
104
  rateInterval: number;
102
105
  rateMessages: Array<{ ts: number, pending: boolean }>;
103
- pending: Array<{ mail: Mail; callback(err: Error | null, info: SESTransport.SentMessageInfo): void; }>;
106
+ pending: Array<{ mail: Mail<SESTransport.SentMessageInfo>; callback(err: Error | null, info: SESTransport.SentMessageInfo): void; }>;
104
107
  idling: boolean;
105
108
 
106
109
  constructor(options: SESTransport.Options);
107
110
 
108
111
  /** Schedules a sending of a message */
109
- send(mail: MailMessage, callback: (err: Error | null, info: SESTransport.SentMessageInfo) => void): void;
112
+ send(mail: MailMessage<SESTransport.SentMessageInfo>, callback: (err: Error | null, info: SESTransport.SentMessageInfo) => void): void;
110
113
 
111
114
  /** Returns true if there are free slots in the queue */
112
115
  isIdle(): boolean;
@@ -17,14 +17,14 @@ export interface Logger {
17
17
  }
18
18
 
19
19
  export interface ResolveHostnameOptions {
20
- host?: string;
21
- servername?: string | false;
20
+ host?: string | undefined;
21
+ servername?: string | false | undefined;
22
22
  }
23
23
 
24
24
  export interface ResolveHostnameValue {
25
25
  host: string;
26
26
  servername: string | false;
27
- _cached?: true;
27
+ _cached?: true | undefined;
28
28
  }
29
29
 
30
30
  export function resolveHostname(options: ResolveHostnameOptions | null | undefined, callback: (err: Error | null, value: ResolveHostnameValue) => void): void;
File without changes
File without changes
@@ -30,12 +30,12 @@ declare namespace SMTPConnection {
30
30
 
31
31
  interface AuthenticationTypeLogin extends Credentials {
32
32
  /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */
33
- type?: 'login' | 'Login' | 'LOGIN';
33
+ type?: 'login' | 'Login' | 'LOGIN' | undefined;
34
34
  }
35
35
 
36
36
  interface AuthenticationTypeOAuth2 extends OAuth2 {
37
37
  /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */
38
- type?: 'oauth2' | 'OAuth2' | 'OAUTH2';
38
+ type?: 'oauth2' | 'OAuth2' | 'OAUTH2' | undefined;
39
39
  }
40
40
 
41
41
  type AuthenticationType = AuthenticationTypeCustom | AuthenticationTypeLogin | AuthenticationTypeOAuth2;
@@ -55,7 +55,7 @@ declare namespace SMTPConnection {
55
55
  response: string;
56
56
  status: number;
57
57
  text: string;
58
- code?: number;
58
+ code?: number | undefined;
59
59
  }
60
60
 
61
61
  interface CustomAuthenticationContext {
@@ -78,13 +78,13 @@ declare namespace SMTPConnection {
78
78
 
79
79
  interface DSNOptions {
80
80
  /** return either the full message ‘FULL’ or only headers ‘HDRS’ */
81
- ret?: 'Full' | 'HDRS';
81
+ ret?: 'Full' | 'HDRS' | undefined;
82
82
  /** sender’s ‘envelope identifier’ for tracking */
83
- envid?: string;
83
+ envid?: string | undefined;
84
84
  /** when to send a DSN. Multiple options are OK - array or comma delimited. NEVER must appear by itself. */
85
- notify?: DSNOption | DSNOption[];
85
+ notify?: DSNOption | DSNOption[] | undefined;
86
86
  /** original recipient */
87
- orcpt?: string;
87
+ orcpt?: string | undefined;
88
88
  }
89
89
 
90
90
  interface Envelope {
@@ -93,22 +93,22 @@ declare namespace SMTPConnection {
93
93
  /** the recipient address or an array of addresses */
94
94
  to: string | string[];
95
95
  /** an optional value of the predicted size of the message in bytes. This value is used if the server supports the SIZE extension (RFC1870) */
96
- size?: number;
96
+ size?: number | undefined;
97
97
  /** if true then inform the server that this message might contain bytes outside 7bit ascii range */
98
- use8BitMime?: boolean;
98
+ use8BitMime?: boolean | undefined;
99
99
  /** the dsn options */
100
- dsn?: DSNOptions;
100
+ dsn?: DSNOptions | undefined;
101
101
  }
102
102
 
103
103
  interface SMTPError extends NodeJS.ErrnoException {
104
104
  /** string code identifying the error, for example ‘EAUTH’ is returned when authentication */
105
- code?: string;
105
+ code?: string | undefined;
106
106
  /** the last response received from the server (if the error is caused by an error response from the server) */
107
- response?: string;
107
+ response?: string | undefined;
108
108
  /** the numeric response code of the response string (if available) */
109
- responseCode?: number;
109
+ responseCode?: number | undefined;
110
110
  /** command which provoked an error */
111
- command?: string;
111
+ command?: string | undefined;
112
112
  }
113
113
 
114
114
  interface SentMessageInfo {
@@ -117,7 +117,7 @@ declare namespace SMTPConnection {
117
117
  /** an array of rejected recipient addresses. This array includes both the addresses that were rejected before sending the message and addresses rejected after sending it if using LMTP */
118
118
  rejected: string[];
119
119
  /** if some recipients were rejected then this property holds an array of error objects for the rejected recipients */
120
- rejectedErrors?: SMTPError[];
120
+ rejectedErrors?: SMTPError[] | undefined;
121
121
  /** the last response received from the server */
122
122
  response: string;
123
123
  /** how long was envelope prepared */
@@ -130,44 +130,44 @@ declare namespace SMTPConnection {
130
130
 
131
131
  interface Options {
132
132
  /** the hostname or IP address to connect to (defaults to ‘localhost’) */
133
- host?: string;
133
+ host?: string | undefined;
134
134
  /** the port to connect to (defaults to 25 or 465) */
135
- port?: number;
135
+ port?: number | undefined;
136
136
  /** defines authentication data */
137
- auth?: AuthenticationType;
137
+ auth?: AuthenticationType | undefined;
138
138
  /** defines if the connection should use SSL (if true) or not (if false) */
139
- secure?: boolean;
139
+ secure?: boolean | undefined;
140
140
  /** turns off STARTTLS support if true */
141
- ignoreTLS?: boolean;
141
+ ignoreTLS?: boolean | undefined;
142
142
  /** forces the client to use STARTTLS. Returns an error if upgrading the connection is not possible or fails. */
143
- requireTLS?: boolean;
143
+ requireTLS?: boolean | undefined;
144
144
  /** tries to use STARTTLS and continues normally if it fails */
145
- opportunisticTLS?: boolean;
145
+ opportunisticTLS?: boolean | undefined;
146
146
  /** optional hostname of the client, used for identifying to the server */
147
- name?: string;
147
+ name?: string | undefined;
148
148
  /** the local interface to bind to for network connections */
149
- localAddress?: string;
149
+ localAddress?: string | undefined;
150
150
  /** how many milliseconds to wait for the connection to establish */
151
- connectionTimeout?: ms;
151
+ connectionTimeout?: ms | undefined;
152
152
  /** how many milliseconds to wait for the greeting after connection is established */
153
- greetingTimeout?: ms;
153
+ greetingTimeout?: ms | undefined;
154
154
  /** how many milliseconds of inactivity to allow */
155
- socketTimeout?: ms;
155
+ socketTimeout?: ms | undefined;
156
156
  /** optional bunyan compatible logger instance. If set to true then logs to console. If value is not set or is false then nothing is logged */
157
- logger?: shared.Logger | boolean;
157
+ logger?: shared.Logger | boolean | undefined;
158
158
  /** if set to true, then logs SMTP traffic without message content */
159
- transactionLog?: boolean;
159
+ transactionLog?: boolean | undefined;
160
160
  /** if set to true, then logs SMTP traffic and message content, otherwise logs only transaction events */
161
- debug?: boolean;
161
+ debug?: boolean | undefined;
162
162
  /** defines preferred authentication method, e.g. ‘PLAIN’ */
163
- authMethod?: string;
163
+ authMethod?: string | undefined;
164
164
  /** defines additional options to be passed to the socket constructor, e.g. {rejectUnauthorized: true} */
165
- tls?: tls.ConnectionOptions;
165
+ tls?: tls.ConnectionOptions | undefined;
166
166
  /** initialized socket to use instead of creating a new one */
167
- socket?: net.Socket;
167
+ socket?: net.Socket | undefined;
168
168
  /** connected socket to use instead of creating and connecting a new one. If secure option is true, then socket is upgraded from plaintext to ciphertext */
169
- connection?: net.Socket;
170
- customAuth?: CustomAuthenticationHandlers;
169
+ connection?: net.Socket | undefined;
170
+ customAuth?: CustomAuthenticationHandlers | undefined;
171
171
  }
172
172
  }
173
173
 
@@ -12,24 +12,24 @@ import SMTPConnection = require('../smtp-connection');
12
12
 
13
13
  declare namespace SMTPPool {
14
14
  interface MailOptions extends Mail.Options {
15
- auth?: SMTPConnection.AuthenticationType;
16
- dsn?: SMTPConnection.DSNOptions;
15
+ auth?: SMTPConnection.AuthenticationType | undefined;
16
+ dsn?: SMTPConnection.DSNOptions | undefined;
17
17
  }
18
18
 
19
19
  interface Options extends MailOptions, TransportOptions, SMTPConnection.Options {
20
20
  /** set to true to use pooled connections (defaults to false) instead of creating a new connection for every email */
21
21
  pool: true;
22
- service?: string;
22
+ service?: string | undefined;
23
23
  getSocket?(options: Options, callback: (err: Error | null, socketOptions: any) => void): void; // TODO http.ClientRequest?
24
- url?: string;
24
+ url?: string | undefined;
25
25
  /** the count of maximum simultaneous connections to make against the SMTP server (defaults to 5) */
26
- maxConnections?: number;
26
+ maxConnections?: number | undefined;
27
27
  /** limits the message count to be sent using a single connection (defaults to 100). After maxMessages is reached the connection is dropped and a new one is created for the following messages */
28
- maxMessages?: number;
28
+ maxMessages?: number | undefined;
29
29
  /** defines the time measuring period in milliseconds (defaults to 1000, ie. to 1 second) for rate limiting */
30
- rateDelta?: number;
30
+ rateDelta?: number | undefined;
31
31
  /** limits the message count to be sent in rateDelta time. Once rateLimit is reached, sending is paused until the end of the measuring period. This limit is shared between connections, so if one connection uses up the limit, then other connections are paused as well. If rateLimit is not set then sending rate is not limited */
32
- rateLimit?: number;
32
+ rateLimit?: number | undefined;
33
33
  }
34
34
 
35
35
  interface SentMessageInfo extends SMTPConnection.SentMessageInfo {
@@ -43,10 +43,10 @@ declare namespace SMTPPool {
43
43
  /**
44
44
  * Creates a SMTP pool transport object for Nodemailer
45
45
  */
46
- declare class SMTPPool extends EventEmitter implements Transport {
46
+ declare class SMTPPool extends EventEmitter implements Transport<SMTPPool.SentMessageInfo> {
47
47
  options: SMTPPool.Options;
48
48
 
49
- mailer: Mail;
49
+ mailer: Mail<SMTPPool.SentMessageInfo>;
50
50
  logger: shared.Logger;
51
51
 
52
52
  name: string;
@@ -60,7 +60,7 @@ declare class SMTPPool extends EventEmitter implements Transport {
60
60
  getSocket(options: SMTPPool.Options, callback: (err: Error | null, socketOptions: any) => void): void;
61
61
 
62
62
  /** Sends an e-mail using the selected settings */
63
- send(mail: MailMessage, callback: (err: Error | null, info: SMTPPool.SentMessageInfo) => void): void;
63
+ send(mail: MailMessage<SMTPPool.SentMessageInfo>, callback: (err: Error | null, info: SMTPPool.SentMessageInfo) => void): void;
64
64
 
65
65
  /** Closes all connections in the pool. If there is a message being sent, the connection is closed later */
66
66
  close(): void;
File without changes
@@ -35,14 +35,14 @@ declare namespace SMTPTransport {
35
35
  type AuthenticationType = AuthenticationTypeLogin | AuthenticationTypeOAuth2;
36
36
 
37
37
  interface MailOptions extends Mail.Options {
38
- auth?: SMTPConnection.AuthenticationType;
39
- dsn?: SMTPConnection.DSNOptions;
38
+ auth?: SMTPConnection.AuthenticationType | undefined;
39
+ dsn?: SMTPConnection.DSNOptions | undefined;
40
40
  }
41
41
 
42
42
  interface Options extends MailOptions, TransportOptions, SMTPConnection.Options {
43
- service?: string;
43
+ service?: string | undefined;
44
44
  getSocket?(options: Options, callback: (err: Error | null, socketOptions: any) => void): void; // TODO http.ClientRequest?
45
- url?: string;
45
+ url?: string | undefined;
46
46
  }
47
47
 
48
48
  interface SentMessageInfo {
@@ -50,13 +50,17 @@ declare namespace SMTPTransport {
50
50
  envelope: MimeNode.Envelope;
51
51
  /** most transports should return the final Message-Id value used with this property */
52
52
  messageId: string;
53
+ accepted: Array<string | Mail.Address>;
54
+ rejected: Array<string | Mail.Address>;
55
+ pending: Array<string | Mail.Address>;
56
+ response: string;
53
57
  }
54
58
  }
55
59
 
56
- declare class SMTPTransport extends EventEmitter implements Transport {
60
+ declare class SMTPTransport extends EventEmitter implements Transport<SMTPTransport.SentMessageInfo> {
57
61
  options: SMTPTransport.Options;
58
62
 
59
- mailer: Mail;
63
+ mailer: Mail<SMTPTransport.SentMessageInfo>;
60
64
  logger: shared.Logger;
61
65
 
62
66
  name: string;
@@ -69,10 +73,15 @@ declare class SMTPTransport extends EventEmitter implements Transport {
69
73
  /** Placeholder function for creating proxy sockets. This method immediatelly returns without a socket */
70
74
  getSocket(options: SMTPTransport.Options, callback: (err: Error | null, socketOptions: object) => void): void;
71
75
 
72
- getAuth(authOpts: SMTPConnection.AuthenticationTypeLogin | SMTPConnection.AuthenticationTypeOAuth2): SMTPTransport.AuthenticationType;
76
+ getAuth(
77
+ authOpts: SMTPConnection.AuthenticationTypeLogin | SMTPConnection.AuthenticationTypeOAuth2,
78
+ ): SMTPTransport.AuthenticationType;
73
79
 
74
80
  /** Sends an e-mail using the selected settings */
75
- send(mail: MailMessage, callback: (err: Error | null, info: SMTPTransport.SentMessageInfo) => void): void;
81
+ send(
82
+ mail: MailMessage<SMTPTransport.SentMessageInfo>,
83
+ callback: (err: Error | null, info: SMTPTransport.SentMessageInfo) => void,
84
+ ): void;
76
85
 
77
86
  /** Verifies SMTP configuration */
78
87
  verify(callback: (err: Error | null, success: true) => void): void;
@@ -17,9 +17,9 @@ declare namespace StreamTransport {
17
17
  interface Options extends MailOptions, TransportOptions {
18
18
  streamTransport: true;
19
19
  /** if true, then returns the message as a Buffer object instead of a stream */
20
- buffer?: boolean;
20
+ buffer?: boolean | undefined;
21
21
  /** either ‘windows’ or ‘unix’ (default). Forces all newlines in the output to either use Windows syntax <CR><LF> or Unix syntax <LF> */
22
- newline?: string;
22
+ newline?: string | undefined;
23
23
  }
24
24
 
25
25
  interface SentMessageInfo {
@@ -29,14 +29,18 @@ declare namespace StreamTransport {
29
29
  messageId: string;
30
30
  /** either stream (default) of buffer depending on the options */
31
31
  message: Buffer | Readable;
32
+ accepted: Array<string | Mail.Address>;
33
+ rejected: Array<string | Mail.Address>;
34
+ pending: Array<string | Mail.Address>;
35
+ response: string;
32
36
  }
33
37
  }
34
38
 
35
- declare class StreamTransport implements Transport {
39
+ declare class StreamTransport implements Transport<StreamTransport.SentMessageInfo> {
36
40
  options: StreamTransport.Options;
37
41
 
38
42
  logger: shared.Logger;
39
- mailer: Mail;
43
+ mailer: Mail<StreamTransport.SentMessageInfo>;
40
44
 
41
45
  name: string;
42
46
  version: string;
@@ -46,7 +50,7 @@ declare class StreamTransport implements Transport {
46
50
  constructor(options: StreamTransport.Options);
47
51
 
48
52
  /** Compiles a mailcomposer message and forwards it to handler that sends it */
49
- send(mail: MailMessage, callback: (err: Error | null, info: StreamTransport.SentMessageInfo) => void): void;
53
+ send(mail: MailMessage<StreamTransport.SentMessageInfo>, callback: (err: Error | null, info: StreamTransport.SentMessageInfo) => void): void;
50
54
  }
51
55
 
52
56
  export = StreamTransport;
File without changes
@@ -11,26 +11,26 @@ type s = number;
11
11
  declare namespace XOAuth2 {
12
12
  interface Options {
13
13
  /** User e-mail address */
14
- user?: string;
14
+ user?: string | undefined;
15
15
  /** Client ID value */
16
- clientId?: string;
16
+ clientId?: string | undefined;
17
17
  /** Client secret value */
18
- clientSecret?: string;
18
+ clientSecret?: string | undefined;
19
19
  /** Refresh token for an user */
20
- refreshToken?: string;
20
+ refreshToken?: string | undefined;
21
21
  /** Endpoint for token generation, defaults to 'https://accounts.google.com/o/oauth2/token' */
22
- accessUrl?: string;
22
+ accessUrl?: string | undefined;
23
23
  /** An existing valid accessToken */
24
- accessToken?: string;
24
+ accessToken?: string | undefined;
25
25
  /** Private key for JSW */
26
- privateKey?: string | { key: string; passphrase: string; };
26
+ privateKey?: string | { key: string; passphrase: string; } | undefined;
27
27
  /** Optional Access Token expire time in ms */
28
- expires?: ms;
28
+ expires?: ms | undefined;
29
29
  /** Optional TTL for Access Token in seconds */
30
- timeout?: s;
30
+ timeout?: s | undefined;
31
31
  /** Function to run when a new access token is required */
32
32
  provisionCallback?(user: string, renew: boolean, callback: (err: Error | null, accessToken: string, expires: number) => void): void;
33
- serviceClient?: string;
33
+ serviceClient?: string | undefined;
34
34
  }
35
35
 
36
36
  interface Token {
@@ -40,7 +40,7 @@ declare namespace XOAuth2 {
40
40
  }
41
41
 
42
42
  interface RequestParams {
43
- customHeaders?: http.OutgoingHttpHeaders;
43
+ customHeaders?: http.OutgoingHttpHeaders | undefined;
44
44
  }
45
45
  }
46
46
 
nodemailer/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@types/nodemailer",
3
- "version": "6.4.0",
3
+ "version": "6.4.4",
4
4
  "description": "TypeScript definitions for Nodemailer",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer",
5
6
  "license": "MIT",
6
7
  "contributors": [
7
8
  {
@@ -31,6 +32,6 @@
31
32
  "dependencies": {
32
33
  "@types/node": "*"
33
34
  },
34
- "typesPublisherContentHash": "0039445f01109c0e68106090b3609cab060c769ad2516b099fdafdb8ca22d4a0",
35
- "typeScriptVersion": "3.3"
35
+ "typesPublisherContentHash": "aabfa060f1f3a5e90fafe4b0747dd2dc57a19d35f7a2cf9942a0595d5bc067ee",
36
+ "typeScriptVersion": "3.6"
36
37
  }