forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodemailer.d.ts
111 lines (96 loc) · 2.95 KB
/
nodemailer.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Type definitions for Nodemailer
// Project: https://github.com/andris9/Nodemailer
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Nodemailer is an easy to use module to send e-mails with Node.JS (using SMTP or sendmail or Amazon SES) and is unicode friendly .
declare class Transport {
static transports: {
SMTP: Transport;
SES: Transport;
SENDMAIL: Transport;
STUB: Transport;
};
constructor(type: string, options?: any);
options: Object;
transportType: string;
sendMailWithTransport(emailMessage: MailComposer, callback?: (err: Error) => any): any;
useDKIM(dkim: DKIMOptions): void;
close(callback?: (err: Error) => any): any;
sendMail(message: MailComposer, callback?: (err: Error) => any): any;
send_mail(message:MailComposer, callback?: (err: Error) => any): any;
}
interface NodeMailerAttachment {
fileName: string;
filePath?: string;
contents?: any;
contentType?: string;
cid?: string;
}
interface MailComposer {
from: string; // sender info
to: string; // Comma separated list of recipients
subject: string; // Subject of the message
headers?: {};
text?: string; // plaintext body
html?: string; // HTML body
attachments?: NodeMailerAttachment[]; // An array of attachments
forceEmbeddedImages?: boolean;
}
interface DKIMOptions{
domainName: string; // signing domain
keySelector: string; // selector name (in this case there's a dkim._domainkey.do-not-trust.node.ee TXT record set up)
privateKey: any;
}
declare class XOAuthGenerator {
constructor(options: XOAuthGeneratorOptions);
generate(callback: () => any): string;
}
interface XOAuthGeneratorOptions {
user: string;
consumerKey: string; // optional
consumerSecret: string; // optional
token: string;
tokenSecret: string;
}
interface XOAuth2Options {
user: string;
clientId: string;
clientSecret: string;
refreshToken: string;
}
interface NodemailerTransportOptions {
service?: string;
auth?: NodemailerAuthInterface;
debug?: boolean;
AWSAccessKeyID?: string;
AWSSecretKey: string;
ServiceUrl: string;
}
interface NodemailerAuthInterface {
user?: string;
pass?: string;
XOAuthToken?: XOAuthGenerator;
XOAuth2?: XOAuth2Options;
}
interface NodemailerSMTPTransportOptions {
service?: string;
host?: string;
port?: number;
secureConnection?: boolean;
name?: string;
auth: NodemailerAuthInterface;
ignoreTLS?: boolean;
debug?: boolean;
maxConnections?: number;
}
interface Nodemailer {
createTransport(type: string): Transport;
createTransport(type: string, options: NodemailerTransportOptions): Transport;
createTransport(type: string, options: NodemailerSMTPTransportOptions): Transport;
createTransport(type: string, path: string): Transport;
createXOAuthGenerator(options: XOAuthGeneratorOptions): XOAuthGenerator;
}
declare module "nodemailer" {
var nodemailer: Nodemailer;
export = nodemailer;
}