/*! * @package @coolgk/utils * @version 2.2.2 * @link https://github.com/coolgk/node-utils * @license MIT * @author Daniel Gong * * Copyright (c) 2017 Daniel Gong . All rights reserved. * Licensed under the MIT License. */ /*! * Copyright (c) 2017 Daniel Gong . All rights reserved. * Licensed under the MIT License. */ import { lookup } from 'mime-types'; import { stripTags } from '@coolgk/string'; export interface IEmailOptions { readonly host: string; readonly stripTags?: typeof stripTags; readonly getMimeType?: typeof lookup; readonly user?: string; readonly password?: string; readonly port?: number; readonly ssl?: boolean; readonly tls?: boolean; readonly domain?: string; readonly authentication?: string[]; } export interface IEmailClient { send: (param1: any, param2: any) => any; } export interface IEmailConfigWithClient { readonly emailClient: IEmailClient; readonly stripTags?: typeof stripTags; readonly getMimeType?: typeof lookup; } export interface IEmailAddress { name?: string; readonly email: string; } export interface IEmailAttachment { readonly path: string; name?: string; type?: string; readonly method?: string; readonly headers?: { [propName: string]: string; }; } export interface ISendOptions { readonly subject: string; readonly message?: string; readonly from: string | IEmailAddress; readonly to: (string | IEmailAddress)[]; readonly cc?: (string | IEmailAddress)[]; readonly bcc?: (string | IEmailAddress)[]; readonly attachments?: IEmailAttachment[]; [key: string]: any; } export declare class Email { private _emailClient; private _stripTags; private _getMimeType; constructor(options?: (IEmailOptions | IEmailConfigWithClient)); send(options: ISendOptions): Promise; private _formatEmailAddress(emails); } export default Email;