forked from storj-archived/service-mailer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
70 lines (70 loc) · 2.01 KB
/
index.d.ts
File metadata and controls
70 lines (70 loc) · 2.01 KB
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
import SMTPTransport from 'nodemailer/lib/smtp-transport';
import { ContextName } from './context';
interface MailerOptions extends Omit<SMTPTransport.Options, 'from'> {
sendgrid: {
api_key: string;
};
from: string;
}
declare class Mailer {
private options;
private transporter;
constructor(options: MailerOptions);
/**
* Sends the email template to the specified address
* using SMTP protocol
* #dispatch
* @param {String} email
* @param {String} template
* @param {Object} context
* @param {Function} callback
*/
dispatch(email: string, template: ContextName, context: any, callback: any): void;
/**
* Sends the email template to the specified address,
* using SendGrid API
* #dispatch
* @param {String} email
* @param {String} template
* @param {Object} context
* @param {Function} callback
*/
dispatchSendGrid(email: string, template: ContextName, context: any, callback: (err?: Error) => void): void;
/**
* Loads and compiles the mail template
* #getTemplate
* @param {String} name
* @param {Function} callback
*/
getTemplate(name: string, callback: (err: Error | null, template?: any) => void): void;
/**
* Helper for loading email template subject
* #_getSubject
* @param {String} name
* @param {Function} callback
*/
private getSubject;
/**
* Helper for loading email template markup
* #_getMarkup
* @param {String} name
* @param {Function} callback
*/
private getMarkup;
/**
* Helper for loading email template plaintext
* #_getPlaintext
* @param {String} name
* @param {Function} callback
*/
private getPlaintext;
/**
* Helper for loading email template resource
* #__getTemplateResource
* @param {String} filename
* @param {Function} callback
*/
private getTemplateResource;
}
export declare function MailerBuilder(options: MailerOptions): Mailer;
export default Mailer;