Constructors

  • Constructs a new instance of the EmailSender class.

    Parameters

    • defaultFrom: string

      The default "from" email address.

    • region: string

      The AWS region to use for sending emails.

    Returns default

    None

Methods

  • Creates a new SMTP transporter for sending emails using NodeMailer.

    Parameters

    • host: string

      The SMTP server host.

    • portNumber: number

      The port number to connect to the SMTP server.

    • user: string

      The username for authentication with the SMTP server.

    • password: string

      The password for authentication with the SMTP server.

    Returns NodeMailerTransportOptions

    • The SMTP transporter object.
  • Sends a raw email with the specified parameters.

    Parameters

    • to: string | string[]

      The recipient(s) of the email.

    • htmlMessage: string

      The HTML content of the email.

    • subject: string

      The subject of the email.

    • OptionaloptionalCC: string | string[]

      The optional CC recipient(s) of the email.

    • OptionaloptionalFrom: string

      The optional sender of the email. If not provided, the default sender will be used.

    • OptionaloptionalReplyTo: string

      The optional reply-to address for the email.

    • OptionaloptionalAttachments: any[]

      The optional attachments to include

    • OptionaloptionalTransport: NodeMailerTransportOptions

    Returns Promise<null>

  • Sends a templated email to the specified recipients.

    Parameters

    • to: string | string[]

      The email address(es) of the recipient(s).

    • templates: string | string[]

      The template(s) to use for the email.

    • data: object

      The data to be used in the email template.

    • OptionaloptionalCC: string | string[]

      The email address(es) to CC.

    • OptionaloptionalFrom: string

      The email address to send the email from.

    • OptionaloptionalReplyTo: string

      The email address to set as the reply-to address.

    • OptionaloptionalAttachments: any[]

      An array

    • OptionaloptionalHeaders: Record<string, string>

      Optional headers to be added to the message. Passed in a key value object.

    • OptionaloptionalTransport: NodeMailerTransportOptions

    Returns Promise<null>

  • Renders the given template with the provided data using the Email class.

    Parameters

    • template: string

      The name or path of the template to render.

    • data: object

      The data object to pass to the template.

    Returns Promise<any>

    • A promise that resolves to true if the template was rendered successfully, false otherwise.