forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodemailer.d.ts
63 lines (53 loc) · 2.01 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
// Type definitions for Nodemailer 1.3.2
// Project: https://github.com/andris9/Nodemailer
// Definitions by: Rogier Schouten <https://github.com/rogierschouten/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="./nodemailer-types.d.ts" />
/// <reference path="../nodemailer-direct-transport/nodemailer-direct-transport.d.ts" />
/// <reference path="../nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts" />
declare module "nodemailer" {
import directTransport = require("nodemailer-direct-transport");
import smtpTransport = require("nodemailer-smtp-transport");
export type Transport = nodemailer.Transport;
export type SendMailOptions = nodemailer.SendMailOptions;
export type SentMessageInfo = nodemailer.SentMessageInfo;
/**
* Transporter plugin
*/
export interface Plugin {
(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void;
}
/**
* This is what you use to send mail
*/
export interface Transporter {
/**
* Send a mail
*/
sendMail(mail: SendMailOptions, callback?: (error: Error, info: SentMessageInfo) => void): void;
/**
* Attach a plugin. 'compile' and 'stream' plugins can be attached with use(plugin) method
*
* @param step is a string, either 'compile' or 'stream' thatd defines when the plugin should be hooked
* @param pluginFunc is a function that takes two arguments: the mail object and a callback function
*/
use(step: string, plugin: Plugin): void;
/**
* Close all connections
*/
close?(): void;
}
/**
* Create a direct transporter
*/
export function createTransport(options?: directTransport.DirectOptions): Transporter;
/**
* Create an SMTP transporter
*/
export function createTransport(options?: smtpTransport.SmtpOptions): Transporter;
/**
* Create a transporter from a given implementation
*/
export function createTransport(transport: Transport): Transporter;
}