Email Template Language
An email template allows you to configure the body of an Email external action-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.
Keys
A key is specified as {<key>}, and it can be referenced multiple times anywhere in a template block. When an email message is generated, keys are resolved to their actual values.
Every FME transformation that generates a message supports a set of standard keys. Other keys available for use are specific to the FME Server service that is invoked. For more information about supported keys, see Email Template Keys .
For example, the following JSON notification is 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 Keys in Emails About Job Failure or Job Success
A JOB_FAILURE Email external action 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}. Access the log file for this job on the Jobs page of the FME Server Web User Interface. Select the job from the Completed table. On the page for the job, view or download the log.
</fmeblock>
A JOB_SUCCESS Email external action 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
- @getFileName: returns the file name only of a full file path.
Sample usage:
<fmeblock type="optional">
Click here to download the result:
{urlPrefix}{ResultRootDir}/{@getFileName(OutputLocation)}
</fmeblock>
HTML Content
A template can be in plain text or HTML. The format is specified by the Email Format property of the external action. HTML tags can be defined inside or outside template blocks. Keys 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>