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, D extends TransportOptions = TransportOptions> = Mail<T, D>;
|
15 |
|
16 | export type SentMessageInfo = any;
|
17 |
|
18 | export interface Transport<T = any, D extends TransportOptions = TransportOptions> {
|
19 | mailer?: Transporter<T, D> | 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: SMTPPool | SMTPPool.Options,
|
47 | defaults?: SMTPPool.Options,
|
48 | ): Transporter<SMTPPool.SentMessageInfo, SMTPPool.Options>;
|
49 | export function createTransport(
|
50 | transport: SendmailTransport | SendmailTransport.Options,
|
51 | defaults?: SendmailTransport.Options,
|
52 | ): Transporter<SendmailTransport.SentMessageInfo, SendmailTransport.Options>;
|
53 | export function createTransport(
|
54 | transport: StreamTransport | StreamTransport.Options,
|
55 | defaults?: StreamTransport.Options,
|
56 | ): Transporter<StreamTransport.SentMessageInfo, StreamTransport.Options>;
|
57 | export function createTransport(
|
58 | transport: JSONTransport | JSONTransport.Options,
|
59 | defaults?: JSONTransport.Options,
|
60 | ): Transporter<JSONTransport.SentMessageInfo, JSONTransport.Options>;
|
61 | export function createTransport(
|
62 | transport: SESTransport | SESTransport.Options,
|
63 | defaults?: SESTransport.Options,
|
64 | ): Transporter<SESTransport.SentMessageInfo, SESTransport.Options>;
|
65 | export function createTransport(
|
66 | transport?: SMTPTransport | SMTPTransport.Options | string,
|
67 | defaults?: SMTPTransport.Options,
|
68 | ): Transporter<SMTPTransport.SentMessageInfo, SMTPTransport.Options>;
|
69 | // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
70 | export function createTransport<T>(
|
71 | transport: Transport<T> | TransportOptions,
|
72 | defaults?: TransportOptions,
|
73 | ): Transporter<SMTPTransport.SentMessageInfo, SMTPTransport.Options>;
|
74 |
|
75 | export function createTestAccount(
|
76 | apiUrl: string,
|
77 | callback: (err: Error | null, testAccount: TestAccount) => void,
|
78 | ): void;
|
79 | export function createTestAccount(callback: (err: Error | null, testAccount: TestAccount) => void): void;
|
80 | export function createTestAccount(apiUrl?: string): Promise<TestAccount>;
|
81 |
|
82 | export function getTestMessageUrl(info: SESTransport.SentMessageInfo | SMTPTransport.SentMessageInfo): string | false;
|
83 |
|
\ | No newline at end of file |