This article is intended for customers that host their own instances. If you are a SaaS customer and want to edit your email templates, please contact Support.


To create a custom email template or edit an existing one, simply open the template you want to work with in your favorite HTML editor and you can customize it from there (avoid word processing programs like MS Word, as they will add extraneous code).  These template files can be found in the following folder of the server where NetX is installed:

x:~/Netxposure/netx/emailTemplates

In this folder, one will find two (and potentially three) versions of each template file.  For each template, there is a working version and a default version which NetX uses to create a new working version if one does not exist.  Additionally, a third version will exist in the case of a custom template, which is the scope of this document. 

The file “downloadApprovalAdmin.tpl” is an example of a working version of an email template.  The default version of that email template has “-default” appended to the filename (i.e. downloadApprovalAdmin-default.tpl).  A custom template is created by making a copy of the default template and appending the “-custom” suffix in place of “-default” (i.e. downloadApprovalAdmin-custom.tpl). 

When a template is called, NetX starts by looking for the “...-custom.tpl”.  If one is found, NetX will generate a new working version of the template from the custom template.  If no custom version of the template exists, NetX will use the existing working version.  If the working version is missing, a new working version will be generated from the default version.  With this in mind, the default template can be restored by simply deleting the existing working version and ensuring that no custom version exists in the emailTemplates folder.

When creating custom email templates specifically for use with AutoTasks, the following naming convention should be followed: "autotaskNotifyXxx.tpl". The Xxx represents a descriptive camel-case name for the template.

In the template you'll find notations for variables (e.g. “${downloadApproval.userLabel} in the image below).  These are variable that represent the values that are injected into the email by the Server when the email is sent.  The variables found in the default template are the only values that can be used in that specific template and if you remove a variable, the associated value will not appear in the email.  


Sample Edit:

Using the template in the image above, you might add any number of custom messages.  For instance, you may wish to add company contact information or a disclaimer to the message.  You can even edit labels like changing

<b>Files:</b>

to

<b>Approved Files:</b>

Once you've finished editing the email template, you will need to save it as a new file.  When you save the new template, replace the “-default.tpl” suffix with “-custom.tpl”.  The updated template file must be placed on the server in the x:~/Netxposure/netx/emailTemplates folder and the server instance must be restarted before the changes will be recognized. 

NOTE:  The location of email templates can be configured by changing the following property:

sys.fileDirectory

It is also worth noting that the "From" address for emails being sent by NetX is configurable via the property noted below.  However, when sharing assets with others (e.g. by following the "Download/Share" workflow), the email is configured as coming from the address of the user who shared the assets.

email.from

Customizing the subject line

You can also customize the subject line of any email template by using the following properties:

Property name = email.subject.TEMPLATENAME (drop the ".tpl" extension)
Property value = WHATEVER YOU WANT FOR THE SUBJECT
CODE

Reloading email templates

After you've made the desired changes to your email templates, you can run a job that will reload them in the application without requiring a restart. See Email Template Loader Job for more information.