email template icon Email Template

Code snippet for calling an email template

You can use the following code snippet for calling your email template from a script:

const html = "<html><body>Hello</body></html>";
await sendEmail("to@email", "Subject", html);

const attachments = [{
filename: "filename.txt",
path: "/path/to/file.txt"
}]
await sendEmail("to@email", "Subject", null, "from@email", "template-id", {name: "John"}, attachments);