You are here: Reference Manual > FME Server Services > Notification Service > Subscribers > Email Template Language

Email Template Language

An email template allows you to configure the body of a subscriber-generated email in a flexible way.

Template Block

A template can contain one or more blocks. A block is defined by XML style tag <fmeblock></fmeblock>. If a template does not contain these starting and ending tags, it is treated as one block.

If the type attribute of a block is specified as optional, the block is not included in the notification email content unless all the macros it contains have been fully resolved.

Sample usage:

<fmeblock type="optional">

FME transformation job {id} succeeded.

</fmeblock>

In this case, the block is only active if the {id} macro is resolved.

Keywords

A keyword is specified as {<keyword>}, and it can be referenced multiple times anywhere in a template block. When a notification email is generated, keywords are resolved to their actual values. Keywords and their values are supplied by FME Notification Service via notifications.

Every FME transformation job that generates a notification supports a set of standard keywords. Other keywords available for use are specific to the FME Server service that is invoked. For more information about supported keywords, see Email Template Keywords .

For example, the following JSON notification generated by the Data Download service:

{

"id":"2",

"requestKeyword":"FILE_DOWNLOAD_SERVICE",

"timeFinished":"Mon-15-Aug-2011 02:01:46 PM",

"timeRequested":"Mon-15-Aug-2011 02:01:45 PM",

"timeStarted":"Mon-15-Aug-2011 02:01:45 PM",

"LogFileName":"datadownload\\FME_7D150E1F_1313442105798_4244.log",

"NumFeaturesOutput":"49",

"OutputLocation":"\\\\Server\\FMEServer\\DefaultResults\\FME_7D150E1F_1313442105798_4244",

"ResultRootDir":"\\fmedatadownload\\results",

"StatusMessage":"Translation Successful",

"StatusNumber":"0"

}

Example: Using Keywords in Emails About Job Failure or Job Success

A JOB_FAILURE email subscriber might use the id and StatusMesssage keywords to indicate which job has failed, and the reason:

<fmeblock type="optional">

Job {id} failed with the message: {StatusMessage}. To access the log file for this job in the FME Server Web User Interface, click Advanced from the menu, and select Job History. On the Jobs page, select the job from the Completed table. On the page for the job, click the Log tab.

</fmeblock>

A JOB_SUCCESS email subscriber might use the same keywords for an email with this message body:

<fmeblock type="optional">

Job {id} succeeded. The Engine status message is {StatusMessage}.

</fmeblock>

Function

A function is a special operator starting with @ that performs a certain action on a given input parameter. The supported functions are:

  • @getFileName: returns the file name only of a full file path.
  • @zip: compresses the given directory or file into a zip file and returns its full path.

Sample usage:

<fmeblock type="optional">

Click here to download the result:

{urlPrefix}{ResultRootDir}/{@getFileName(@zip(OutputLocation))}

</fmeblock>

Here the {@getFileName(@zip(OutputLocation))} is a chain call of two functions. It first compresses the folder specified by macro OutputLocation and then returns the zip file name.

HTML Content

A template can be in plain text or HTML. The format is specified by the Email Format property of the subscriber. HTML tags can be defined inside or outside template blocks. Keywords can be used in HTML in the same manner as in plain text.

Sample usage:

<fmeblock type="optional">

Job {id} succeeded.<br>

This is a URL: <a href=”www.mycompany.com”>My Company</a>

</fmeblock>