Email format
This document explains how PageSeeder can be configured to send emails in HTML, plain text or both (default).
HTML emails
Each email is generated by a template in XSLT which is responsible for generating the content sent by email.
To send HTML emails:
- The template must be located in the Notification folder and have one of the reserved template names. See list of email templates (for example:
change-password.xsl). - The output format is set by PageSeeder to be XHTML with a doctype declaration of -//W3C//DTD XHTML Basic 1.0//EN.
- The XSLT has the following structure.
Basic template structure
<!-- Email template -->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Use UTF-8 and proper HTML doctype -->
<xsl:output encoding="UTF-8"
method="html"
indent="yes"
omit-xml-declaration="yes"
doctype-public="-//W3C//DTD HTML 4.01 Transitional //EN" />
<xsl:template match="/notification">
<html>
<head>
<title>[Subject of Email]</title>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8" />
<!-- Other Meta elements can go here ... -->
</head>
<!-- HTML content -->
<body>
<!-- HTML content goes here -->
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Recommendations
HTML emails are quite hard to design as email clients have a tendency to behave differently with various standards. The guidelines when writing HTML emails are as follows:
- Use basic HTML (such as tables, headings and paragraphs).
- Use tables for layout, or even nested tables.
- No inline images.
- No inline javascript.
- Use web-safe fonts.
- Use inline CSS.
Plain text emails
The content of text emails is also generated by XSLT templates which must:
- Exist in the Notification folder.
- Conform to this format for filenames
[template name]-text.xsl.
(see list of templates, for example:change-password-text.xsl). - Output plain text format.
Basic template structure
<!-- Email template -->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Use ASCII -->
<xsl:output encoding="ASCII" method="text" />
<xsl:template match="/notification">
<!-- plain text content goes here -->
</xsl:template>
</xsl:stylesheet>