sendMail

Sends an email using a predefined template. It uses the MessageQueue entity to store the email body.

IMPORTANT!  
Starting with v22.1.9, emails are sent asynchronously using job servers after EmailChannelProviderName is enabled in the Configuration Manager.
For v22.1.8 and prior, this function requires a valid SMTP server configured in the web service.

Syntax

Copy
function sendMail(templateName: string, to: string[], tokens: any, attachments: any,  cc: string[]): void
 
Parameter Description
templateName Name of a predefined email template to be used.
to Recipient's email address.
tokens Keys for substitution. They are defined as properties of an object and replaced with their values. Tokens are enclosed in brackets in the email template body (e.g., {accountName}).
attachments The files to be attached to the email. This is a JSON object with its key-value pairs representing:
  • key – The name of the file as it will be attached to the email. When attaching multiple files, you must provide unique names for each of them.
  • value – Unique internal ID of the corresponding file (real name) as it is stored on the FintechOS server.
Both names should include the file extension.
cc Array of strings containing the Carbon Copy email recipients.

Examples