HTML emails


OpenVPMS currently supports plain-text email. This project will replace the plain-text email support with HTML, to provide rich-text emails.

It will support email templates, to enable rapid generation of standard emails. Email templates may be created in Word, OpenOffice or JasperReports. They will be converted to HTML.

User Interface Changes


The Mail editor will be changed to replace the plain-text editor with a rich-text editor. This provides support limited support for editing HTML. In particular it supports:

  • font style (normal, headings 1-6, preformatted, address)

  • font name

  • font size

  • bold

  • italic

  • underline

  • superscript

  • subscript

  • text alignment (left, centre, right, justify)

  • indenting

  • bullets

  • numbering


The rich text editor has the following limitations:

  • It doesn't support editing images or links, but it can view them, when the mail is generated from a template.

  • It also provides a button to perform spell checking, but this requires additional development work, outside of the scope of this project.

Template Selection

A Template button will be added to the Mail editor that:

  • lists available email templates for selection

  • enables the user to filter templates based on name
    When a template is selected, it will replace the subject and body of the current email.

If the Template button is pressed and there is existing content, a warning will be displayed:

1 Selecting an email template will replace existing content. Do you wish to proceed?

Macro Expansion

Macro expansion will be supported when editing HTML emails. The only restriction is that macros may only generate plain text.

Any html will be escaped.


A new document template type, entity.documentTemplateEmail will be created to hold email templates. This will have the following nodes:

  • name - the template name

  • subject - an optional email subject

  • contentType - identifies the type of the template content. One of:

    • TEXT


  • content - stores text content, used for migrating existing templates

  • expression - an optional xpath expression used to supply an object to the template. See

For templates with contentType = DOCUMENT, the template content will be stored by an act.documentTemplate.

The existing entity.documentTemplate emailSubject and emailBody nodes will be removed. These will be replaced by a relationship to an entity.documentTemplateEmail.

By default, templates will be processed using JasperReports or OpenOffice, depending on the mime-type. If a template has a text/plain mime-type, it will be converted to html. This is to support migration of existing entity.documentTemplate.

Statements and Reminders

Currently statements and reminders are sent with the subject and body coming from the entity.documentTemplate emailSubject and emailText nodes respectively.

This will be changed to use the entity.documentTemplateEmail linked to the entity.documentTemplate. If a statement or reminder template doesn't have a linked entity.documentTemplateEmail, an exception will be thrown.


The existing entity.documentTemplate archetype has emailSubject and emailText nodes. These will be removed.

For each entity.documentTemplate that has content for these, the following will be created:

  • entity.documentTemplateEmail - the subject node will contain the emailSubject, the content node will contain the emailText, and the name will be copied from the entity.documentTemplate

  • an entityLink.documentTemplateEmail linking the entity.documentTemplate to entity.documentTemplateEmail





Tim Anderson


Tim Anderson



Time tracking



Fix versions