import Email from 'email-templates'; export default class Mailer { /** * The starting point of a range. * @type {string} */ private readonly from; /** * The default file template for the application. * @type {string} */ private readonly templateDefaultFile; /** * The transporter object used for sending emails using the AWS SES service. * @type {ReturnType>} */ private readonly transporter; /** * Constructs a new instance of the EmailSender class. * @param {string} defaultFrom - The default "from" email address. * @param {string} region - The AWS region to use for sending emails. * @returns None */ constructor(defaultFrom: string, region: string); /** * Sends a raw email with the specified parameters. * @param {string | Array} to - The recipient(s) of the email. * @param {string} htmlMessage - The HTML content of the email. * @param {string} subject - The subject of the email. * @param {string | Array} [optionalCC] - The optional CC recipient(s) of the email. * @param {string} [optionalFrom] - The optional sender of the email. If not provided, the default sender will be used. * @param {string} [optionalReplyTo] - The optional reply-to address for the email. * @param {any[]} [optionalAttachments] - The optional attachments to include */ sendRawEmail(to: string | Array, htmlMessage: string, subject: string, optionalCC?: string | Array, optionalFrom?: string, optionalReplyTo?: string, optionalAttachments?: any[], optionalTransport?: Email.NodeMailerTransportOptions): Promise; /** * Sends a templated email to the specified recipients. * @param {string | Array} to - The email address(es) of the recipient(s). * @param {string | Array} templates - The template(s) to use for the email. * @param {object} data - The data to be used in the email template. * @param {string | Array} [optionalCC] - The email address(es) to CC. * @param {string} [optionalFrom] - The email address to send the email from. * @param {string} [optionalReplyTo] - The email address to set as the reply-to address. * @param {any[]} [optionalAttachments] - An array */ sendTemplatedEmail(to: string | Array, templates: string | Array, data: object, optionalCC?: string | Array, optionalFrom?: string, optionalReplyTo?: string, optionalAttachments?: any[], optionalTransport?: Email.NodeMailerTransportOptions): Promise; /** * Creates a new SMTP transporter for sending emails using NodeMailer. * @param {string} host - The SMTP server host. * @param {number} portNumber - The port number to connect to the SMTP server. * @param {string} user - The username for authentication with the SMTP server. * @param {string} password - The password for authentication with the SMTP server. * @returns {Email.NodeMailerTransportOptions} - The SMTP transporter object. */ newSMTPTransporter(host: string, portNumber: number, user: string, password: string): Email.NodeMailerTransportOptions; /** * Chooses a template from the given array of templates or a single template string based on whether it can be rendered with the provided data. * @param {string | Array} templates - The template(s) to choose from. * @param {object} data - The data to be used for rendering the template. * @returns {Promise} - The chosen template. * @throws {Error} - If no template can be rendered with the provided data. */ private chooseTemplate; /** * Checks if a given email template can be rendered with the provided data. * @param {string} template - The name of the email template. * @param {object} data - The data to be used for rendering the template. * @returns {Promise} - A promise that resolves to true if the template can be rendered, false otherwise. */ private canRenderTemplate; /** * Renders the given template with the provided data using the Email class. * @param {string} template - The name or path of the template to render. * @param {object} data - The data object to pass to the template. * @returns {Promise} - A promise that resolves to true if the template was rendered successfully, false otherwise. */ static renderTemplate(template: string, data: object): Promise; }