Message format

A notification template must specify the MIME type of the message content. In notification templates, the MIME type argument is specified in square brackets with /mimeMessage/messageContent.

The MIME type can have one of two values:

  • text/plain. Notification messages appear in plain text. This is the default setting.
  • text/html. Notification messages include HTML tags. Use this setting to control the appearance of the content within the message. The HTML within the message must be well-formed.

It is a good practice to always encode template output as Unicode (UTF-8).

HTML notification templates can take advantage of the functionality allowed in the markup. For example, the message can include a link to a Web page or to output from the job.

The following template generates a notification message for job step completion, formats content as a table, specifies background color for the message using an inline style for body, and defines a blue Verdana font for paragraphs using an internal style sheet. The message also includes a link to the job output.

/mimeMessage/messageSubject=${JobName}/${JobStepName} completed successfully
/mimeMessage/messageContent[text/html;charset=utf-8]=
            <html>
            <head>
            <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
            <style type="text/css"> 
            table {font-family: verdana; color: #000080}
            p {font-family: verdana; color: #000080}         
            .foot {font-size: 75%; font-style: italic} </style>
            </head>
            <body style="background-color: #DCDCDC">
            <table border="8" align="center" width = 100%> 
            <tr align="left">
            <th>Job/step name</th>
            <td>${JobName}/${JobStepName}</td>
            </tr>
            <tr align="left">
            <th>End time</th>
            <td> ${JobStepEnd}</td>
            </tr>
            <tr align="left">
            <th>Output</th>
            <td><p>
            #if ($JobStepArtifacts) 
              #foreach($artifact in $JobStepArtifacts)
                <a href='$artifact.get("url")'>$artifact.get("filename")</a><br>
              #end
            #else None <br>
            #end
            <p></td>
            </tr>
            </table>
            <hr/>
            <p class="foot">This is a machine generated message. 
            Please do not reply directly. If you do not wish to receive
            this notification, unsubscribe or contact your
            <a href="mailto:admin@mycompany.com"> your IBM SPSS Deployment
            Services administrator.</a></p></body>
            </html>