Email: sending email from a template

You can send an email from a template using the following function:

sendAlertEmailFromTemplate(String from, Number templateId, String destinations, String priority, boolean isHtmlContent, NativeObject jsObj,  filesToAttach)

With this function, the fields FROM and TO must be USER_CODE_ID (Usernames, not email addresses).

To send the email from a real address instead that from a USER_CODE_ID you must set the value FROM inside the email template.