import EmailTemplate from './email-template'; import * as nodemailer from 'nodemailer'; import { Db } from 'mongodb'; import { Request } from 'express'; export default class Mailer { /** The settings used by this mailer. */ private settings; /** A reference to the transport used to send the email */ private transport; /** The database this mailer will pull configuration from. */ private readonly db; /** The request this mailer will send emails for. */ private readonly req; /** Create a nodemailer SMTP transport from the SMTP Transport settings */ constructor(db: Db, req: Request); /** * Sends an email with an optional email template. * @param template the email template to use to generate the email contents. */ send(options: nodemailer.SendMailOptions): Promise; send(options: nodemailer.SendMailOptions, template: EmailTemplate, data: any): Promise; } /** Contains the data from sending an email via SMTP. */ export interface MailerResult { /** The final message id. */ messageId: string; /** The message envelope. */ envelope: any; /** The addresses that accepted the message. */ accepted: string[]; /** The addresses that rejected the message. */ rejected: string[]; /** The last SMTP response. */ response: string; }