Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace MLGenerator

Namespace containing the code for Generating the Code and delivering the mails

Index

Functions

generateCodes

  • generateCodes(resolve: (value?: MLGenReturn) => void, error: (reason?: any) => void, mailArray: MLItem[], config: any, dataSafe: SecureVault): Promise<void>
  • Generate the same amout of codes as distinct mail adresses and stores them to the list file This function also includes previously used tokens to prevent duplicate tokens. Rejects if matchfile cannot be saved.

    internal

    Parameters

    • resolve: (value?: MLGenReturn) => void

      Callback to resolve promise

    • error: (reason?: any) => void

      Callback to reject promise

        • (reason?: any): void
        • Parameters

          • Optional reason: any

          Returns void

    • mailArray: MLItem[]

      list of mail adresses

    • config: any

      Main configuration object This Function uses the following variables: usedTokens -> List of previosly used tokens outFileMatch -> Path to match file

    • dataSafe: SecureVault

      Main safe used for logging and storing data

    Returns Promise<void>

generateToken

  • Main function used to generate and deliver codes

    Parameters

    • config: any

      Main configuration object

    • dataSafe: SecureVault

      Main safe used for logging and storing data

    Returns Promise<MLGenReturn>

    used codes and processed mails

send

  • send(name: string, mail: string, code: string, template: HandlebarsTemplateDelegate<any>, mailserver: Mail, config: any, dataSafe: SecureVault): Promise<void>
  • Reads template file and compiles template. Iterate through mails and codes, randomly assign code to mail and send mail to recipient. If dryrun is enabled, mails will not be sent and new mails won't be included in return. Rejects if template cannot be read.

    internal

    Parameters

    • name: string

      Name of recpipient

    • mail: string

      Mail of recpipient

    • code: string

      Code of recpipient

    • template: HandlebarsTemplateDelegate<any>

      compiled mail template

    • mailserver: Mail

      Mailserver settings

    • config: any

      Main configuration object This Function uses the following variables: mail.auth.user -> sender mail adress mailFrom -> sender mail ailas dryrun -> Boolean value. If true no mails will be sent.

    • dataSafe: SecureVault

      Main safe used for logging and storing data

    Returns Promise<void>

sendMails

  • sendMails(resolve: (value?: MLGenReturn) => void, error: (reason?: any) => void, mailArray: MLItem[], codeArray: string[], config: any, dataSafe: SecureVault): Promise<void>
  • Reads template file and compiles template. Iterate through mails and codes, randomly assign code to mail and send mail to recipient. If dryrun is enabled, mails will not be sent and new mails won't be included in return. Rejects if template cannot be read.

    internal

    Parameters

    • resolve: (value?: MLGenReturn) => void

      Callback to resolve promise

    • error: (reason?: any) => void

      Callback to reject promise

        • (reason?: any): void
        • Parameters

          • Optional reason: any

          Returns void

    • mailArray: MLItem[]

      list of mail adresses

    • codeArray: string[]

      list of generated codes

    • config: any

      Main configuration object This Function uses the following variables: htmlPath -> Path to html template dryrun -> Boolean value. If true no mails will be sent and list won't be updated. force -> Boolean value. If true all mails are resent. usedTokens -> Array of Strings. Specifies already used tokens adresses. usedMails -> Array of Strings. Specifies already served mail adresses. mail -> mailserver settings

    • dataSafe: SecureVault

      Main safe used for logging and storing data

    Returns Promise<void>

Generated using TypeDoc