1 |
|
2 |
|
3 | import JSONTransport = require("./lib/json-transport");
|
4 | import Mail = require("./lib/mailer");
|
5 | import MailMessage = require("./lib/mailer/mail-message");
|
6 | import SendmailTransport = require("./lib/sendmail-transport");
|
7 | import SESTransport = require("./lib/ses-transport");
|
8 | import SMTPPool = require("./lib/smtp-pool");
|
9 | import SMTPTransport = require("./lib/smtp-transport");
|
10 | import StreamTransport = require("./lib/stream-transport");
|
11 |
|
12 | export type SendMailOptions = Mail.Options;
|
13 |
|
14 | export type Transporter<T = any> = Mail<T>;
|
15 |
|
16 | export type SentMessageInfo = any;
|
17 |
|
18 | export interface Transport<T = any> {
|
19 | mailer?: Transporter<T> | undefined;
|
20 |
|
21 | name: string;
|
22 | version: string;
|
23 |
|
24 | send(mail: MailMessage<T>, callback: (err: Error | null, info: T) => void): void;
|
25 |
|
26 | verify?(callback: (err: Error | null, success: true) => void): void;
|
27 | verify?(): Promise<true>;
|
28 |
|
29 | close?(): void;
|
30 | }
|
31 |
|
32 | export interface TransportOptions {
|
33 | component?: string | undefined;
|
34 | }
|
35 |
|
36 | export interface TestAccount {
|
37 | user: string;
|
38 | pass: string;
|
39 | smtp: { host: string; port: number; secure: boolean };
|
40 | imap: { host: string; port: number; secure: boolean };
|
41 | pop3: { host: string; port: number; secure: boolean };
|
42 | web: string;
|
43 | }
|
44 |
|
45 | export function createTransport(
|
46 | transport?: SMTPTransport | SMTPTransport.Options | string,
|
47 | defaults?: SMTPTransport.Options,
|
48 | ): Transporter<SMTPTransport.SentMessageInfo>;
|
49 | export function createTransport(
|
50 | transport: SMTPPool | SMTPPool.Options,
|
51 | defaults?: SMTPPool.Options,
|
52 | ): Transporter<SMTPPool.SentMessageInfo>;
|
53 | export function createTransport(
|
54 | transport: SendmailTransport | SendmailTransport.Options,
|
55 | defaults?: SendmailTransport.Options,
|
56 | ): Transporter<SendmailTransport.SentMessageInfo>;
|
57 | export function createTransport(
|
58 | transport: StreamTransport | StreamTransport.Options,
|
59 | defaults?: StreamTransport.Options,
|
60 | ): Transporter<StreamTransport.SentMessageInfo>;
|
61 | export function createTransport(
|
62 | transport: JSONTransport | JSONTransport.Options,
|
63 | defaults?: JSONTransport.Options,
|
64 | ): Transporter<JSONTransport.SentMessageInfo>;
|
65 | export function createTransport(
|
66 | transport: SESTransport | SESTransport.Options,
|
67 | defaults?: SESTransport.Options,
|
68 | ): Transporter<SESTransport.SentMessageInfo>;
|
69 | export function createTransport<T>(
|
70 | transport: Transport<T> | TransportOptions,
|
71 | defaults?: TransportOptions,
|
72 | ): Transporter<T>;
|
73 |
|
74 | export function createTestAccount(
|
75 | apiUrl: string,
|
76 | callback: (err: Error | null, testAccount: TestAccount) => void,
|
77 | ): void;
|
78 | export function createTestAccount(callback: (err: Error | null, testAccount: TestAccount) => void): void;
|
79 | export function createTestAccount(apiUrl?: string): Promise<TestAccount>;
|
80 |
|
81 | export function getTestMessageUrl(info: SESTransport.SentMessageInfo | SMTPTransport.SentMessageInfo): string | false;
|
82 |
|
\ | No newline at end of file |