1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | import JSONTransport = require('./lib/json-transport');
|
12 | import Mail = require('./lib/mailer');
|
13 | import MailMessage = require('./lib/mailer/mail-message');
|
14 | import SendmailTransport = require('./lib/sendmail-transport');
|
15 | import SESTransport = require('./lib/ses-transport');
|
16 | import SMTPPool = require('./lib/smtp-pool');
|
17 | import SMTPTransport = require('./lib/smtp-transport');
|
18 | import StreamTransport = require('./lib/stream-transport');
|
19 |
|
20 | export type SendMailOptions = Mail.Options;
|
21 |
|
22 | export type Transporter<T = any> = Mail<T>;
|
23 |
|
24 | export type SentMessageInfo = any;
|
25 |
|
26 | export interface Transport<T = any> {
|
27 | mailer?: Transporter<T> | undefined;
|
28 |
|
29 | name: string;
|
30 | version: string;
|
31 |
|
32 | send(mail: MailMessage<T>, callback: (err: Error | null, info: T) => void): void;
|
33 |
|
34 | verify?(callback: (err: Error | null, success: true) => void): void;
|
35 | verify?(): Promise<true>;
|
36 |
|
37 | close?(): void;
|
38 | }
|
39 |
|
40 | export interface TransportOptions {
|
41 | component?: string | undefined;
|
42 | }
|
43 |
|
44 | export interface TestAccount {
|
45 | user: string;
|
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 };
|
50 | web: string;
|
51 | }
|
52 |
|
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>;
|
75 |
|
76 | export function createTestAccount(
|
77 | apiUrl: string,
|
78 | callback: (err: Error | null, testAccount: TestAccount) => void,
|
79 | ): void;
|
80 | export function createTestAccount(callback: (err: Error | null, testAccount: TestAccount) => void): void;
|
81 | export function createTestAccount(apiUrl?: string): Promise<TestAccount>;
|
82 |
|
83 | export function getTestMessageUrl(info: SESTransport.SentMessageInfo | SMTPTransport.SentMessageInfo): string | false;
|
84 |
|
\ | No newline at end of file |