Email templates are a powerful instrument to customize layout and content of email
messages. Templates are defined as XML files, and are located in the
/opt/savapage/server/custom/template/
directory by
default (alternative locations
can be configured).
Default templates are present in the SavaPage i18n jars. Therefore, after a
first-time installation the custom template/
directory will be
empty. However, when SavaPage finds a suitable i18n XML file in the custom
directory, that belongs to an Email
Message Type, it will use that template.
You can create i18n variants of template XML files by appending the locale to the
base file name. For example: template_de.html
is the German
variant of template.xml
.
The base syntax of an Email Template[40] is described by example in the following XML file:
<?xml version= "1.0" encoding= "UTF-8" ?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <!-- $obj.attr$ placeholders are replaced at runtime --> <!-- TEXT --> <entry key="text"><![CDATA[Text with $obj.attr$ placeholders.]]></entry> <!-- HTML --> <entry key="html"><![CDATA[<b>HTML</b><p> with $obj.attr$ and other placeholders</p>]]> </entry> </properties>
DTD of XML persisted
| |
Placeholder object attributes are identified by a
| |
Content for plain | |
Content for |
HTML content may contain Embedded (Inline) Images.
Images are first defined in separated template entries with keys that have
“cid_
” prefix. Those keys can then
be used as placeholders for cid
scheme values.
SavaPage email processor will embed the image file and replace
cid
placeholders with a unique Content-ID for the
Embedded (Inline) Image.
Custom image files are referred to by their relative path from the custom
template/
directory. Internal stock images can
simply be referred to by their upper-case identifier, as shown in the table
below.
Object.attribute | Value |
---|---|
|
SavaPage Icon: 32 x 32 pixels, 705 bytes. |
|
SavaPage Logo with "SavaPage" text at the bottom: 148 x 174 pixels, 5.6 kB. |
Table 20.1. Stock Image Identifiers
The XML snippet below shows how it works:
<entry key="cid_1">SAVAPAGE_ICON</entry> <entry key="cid_2">images/mysite-logo.png</entry> <entry key="html"><![CDATA[ <img src="cid:$cid_1$" alt="$app.name$"> <a href="https://mysite.xyz"> <img alt="mysite.xyz" src="cid:$cid_2$"/> </a> ]]></entry>
| |
| |
Note that the URL of the image has scheme
| |
The |
An Email Stationary Template is used by an Email Message Template as container to embed its content in. A stationary is typically used by many Email Messages Types, and thus gives a common look-and-feel to various email output.
A Stationary Template contains the following placeholder objects:
And this is how it looks like:
<?xml version= "1.0" encoding= "UTF-8" ?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <!-- TEXT --> <entry key="text"><![CDATA[Plain text with $stationary.header$ $stationary.content$ and additional app placeholders]]></entry> <!-- HTML --> <entry key="html"><![CDATA[HTML with <b>$stationary.header$</b> <p>$stationary.content$ and additional cid_ and app placeholders</p>]]> </entry> </properties>
SavaPage uses its own stationary types. These types can be overwritten. See Section 20.2.5, “Email Stationary Types”.
Email Message Templates are used by Email Message Types.
Template and Type are tied by name.
For example: the JobTicketCompleted message type will look for the nearest i18n
version of a JobTicketCompleted.xml
template file. In this
way, JobTicketCompleted_de.xml
will be the perfect match
when a German email message is requested.
Email Message Template adds the entry key
“subject
” to the syntax. Optionally, entry
keys “stationary
” and
“header
” can be used to link to an Email Stationary
Template.
The syntax is described by example in the following XML file:
<?xml version= "1.0" encoding= "UTF-8" ?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <!-- Email subject --> <entry key="subject">Text with $obj.attr$ placeholders</entry> <!-- Optional stationary --> <entry key="stationary">EmailStationary</entry> <entry key="header">Stationary header with placeholders</entry> <!-- TEXT --> <entry key="text"><![CDATA[Plain text with placeholders.]]></entry> <!-- HTML --> <entry key="html"><![CDATA[<p>HTML with placeholders.</p>]]></entry> </properties>
The | |
The |
Placeholder Objects are used in Email Stationary, and in Email Message Templates tied to Email Messages Types.
Object uniquely used by Email Stationary Template.
Object.attribute | Value |
---|---|
|
The |
|
The |
Table 20.2. Placeholder: Stationary
A global object with SavaPage application attributes. This object can be used in any Email Message Type context.
Object.attribute | Value |
---|---|
|
Application name: “SavaPage” |
|
Formatted name and version, like: “SavaPage Major.Minor.Revision” |
|
Formatted name, version and build, like: “SavaPage Major.Minor.Revision (Build)” |
|
Short slogan describing the application: “Open Print Portal” |
Table 20.3. Placeholder: Application
A Print Job Ticket. See Chapter 5, Job Tickets Web App.
Object.attribute | Value |
---|---|
|
Ticket number. |
|
Document name. |
| Name of the Job Ticket Operator. |
| The return message to Job Ticket Creator (optional). |
Table 20.4. Placeholder: Ticket
SavaPage uses its own Email Stationary Types. As the table below shows,
currently there is just one type in use. You can use this type in your own
custom Email Message
Template files. Or, you can override this type by creating your own
EmailStationary.xml
i18n variants in the custom
template/
directory.
The sections below describe email message types that can be customized. The list is limited for now, but will grow as more messages are refactored for this purpose.
The global Application Object is valid for each message type.
Email sent when a Job Ticket is canceled. See Table 3.8, “Job Ticket Print Configuration Properties”.
The following placeholder objects apply:
Email sent when a Job Ticket is completed successfully. See Table 3.8, “Job Ticket Print Configuration Properties”.
The following placeholder objects apply:
Custom templates are located in the
/opt/savapage/server/custom/template/
directory.
Sub-locations can be defined for different template groups. These sub-locations
can then be activated for different applications, with the following
configuration properties:
Configuration property | Description |
---|---|
custom.template.home |
Home location of all
template files, relative to the default location. For
example: a value of
“
|
custom.template.home.mail |
Home location of Email template files, relative to the
default location. For example: a value of
“
|
Table 20.9. Configuration Properties for Custom Template Locations
See Section 4.11.14, “Config Editor” on how to set these items.