UNPKG

mail-bridge

Version:

Send email using any email provider.

66 lines (63 loc) 1.4 kB
type EMAIL = { to: string | string[]; from?: string; subject: string; text: string; }; type PROVIDER = "resend" | "brevo" | "aws_ses" | "smtp" | "mailgun" | "gmail" | "outlook"; type CONFIG = { aws_ses?: { region: string; }; brevo?: Transporter; gmail?: Transporter; mailgun?: { api_key: string; domain: string; }; outlook?: Transporter; resend?: { api_key: string; }; smtp?: Transporter; }; type EMAIL_SENT_RESPONSE = { provider: PROVIDER; time: any; id?: string; email: EMAIL; }; type Transporter = { host: string; port: number; auth: { user: string; pass: string; }; }; declare class MailBridge { private config; private provider_priority; private defaultFrom; private retryCount; constructor({ config, defaultFrom, priority, retryCount, }: { config: CONFIG; defaultFrom: string; priority?: PROVIDER[]; retryCount?: number; }); send(email: EMAIL, override?: { provider?: PROVIDER; retryCount?: number; }): Promise<EMAIL_SENT_RESPONSE>; /** * Check the configuration of the MailBridge */ checkConfig(): { providers: PROVIDER[]; errors: string[]; defaultFrom: string | undefined; comment: string; }; } export { MailBridge };