The Imixs-MailPlugin provides a convenient way to send e-mail messages through a corresponding BPMN event. The Imixs-MailPlugin is based on the Java Mail API and can be activated by adding the plugin class to the corresponding model definition:


Sending an E-Mail can be configured by the corresponding BPMN event using the Imixs-BPMN modeling tool in various ways.

The subject and the body of the e-mail can contain any information from the corresponding workitem. The content can either be plain text or HTML mail. The recipients of the e-mail can be computed on naming attributes of the workitem or by fixed mail addresses or distribution lists.

The Mail Content

The content of the email can either be plain text or HTML. Using the item-Tag a subject or the e-mail body can be combined with any information from the current workitem as also with properties from the file.

See the following plain text example:

Dear <itemValue>firstName</itemValue> <itemValue>lastName</itemValue>,

A new task needs your attention. Please click on the following link to see further information: 

In case of questions or problems, please contact the Workflow team.    


The Mail body can contain plain text or HTML. A HTML Mail must start with the tags <!doctype…>" or <html…>. Also a html mail can be combined with values from the current workitem.

See the following HTML example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Workflow Message</title>
/* optional css definition  */

<body bgcolor="#f6f6f6">

    <!-- body -->
    <div class="container" bgcolor="#FFFFFF">
       <!-- content -->
       <div class="content">
         <h1>Dear <itemValue>firstName</itemValue> <itemValue>lastName</itemValue>, </h1>
         <p>A new task needs your attention.</p>

XSL Templates

For a more complex e-mail message, the Imixs-MailPlugin supports also e-mail Templates. With this feature the e-mail output is based on a XSL Template. This opens up a powerful way to configure the mail content.

To activate the template mode, a valid XSL document need to put into the mail body definition. The template will be processed automatically with the XML representation of the current workitem.

See the following XSL Template example:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns=""
    xmlns:xsl="" version="1.0">
    <xsl:output method="html" media-type="text/html" indent="no"
       encoding="ISO-8859-1" />
    <xsl:template match="/">
              <xsl:value-of select="document/item[@name='txtname']/value" />


Further configuration is supported by the Imixs-MailPlugin.

Default Sender Address

The default sender address will be set with the current user name. The sender address can be changed by the imixs property ‘mail.defaultSender’. If the property is defined, the plugin overwrites the ‘From’ attribute of every mail with the DefaultSender address. If no value is set the mail will be send from the current users mail address.

Example (

# Marty Mail Plugin

A subclass of the MailPlugin can change the behavior by overwriting the method ‘getFrom()’

Testing Mode

During development you can switch the Imixs-MailPlugin into a Testing-Mode by defining the imixs property:


The property value can contain one ore many (comma separated) Email addresses. If the property is defined, than an e-mail message will be send only to those recipients. The Subject will be prefixed with the text ‘TEST: ’.

Example (



The default character-set used for the mail subject and body parts is set to ‘ISO-8859-1’. It is possible to switch to a specific character set . There for the key ‘mail.charSet’ can be used.

Example (


Cancel e-mail

Sending a e-mail message can be canceled by the application or another plugin by setting the attribute ‘keyMailInactive’ to ‘true’. The attribute is part of the corresponding BPMN event.


The attribute can be set by the Imixs-RulePlugin.

Receipients and Event Properties

A E-Mail message consists of a list of recipients. The recipients can be mapped to name-fields defined in the BPMN definition.

The following event properties are supported:

Name Type Description
txtMailSubject String Mail Subject
rtfMailBody String Mail Body (can be plain text or HTML
namMailReplyToUser String Reply To address. If not set the reply address is the sender address
namMailReceiver String (list) Receiver list (TO)
namMailReceiver String (list) Receiver list (TO)
namMailReceiverCC String (list) Receiver list (CC)
namMailReceiverBCC String (list) Receiver list (BCC)
keyMailInactive Boolean If true, the e-mail will be canceled (can be set by other plugins)


Running the Imixs MailPlugin in a EJB container requires a valid JNDI mail resource. A mail resource can be configured from the application server environment. The expected JNDI resource name to lookup the mail resource by the Imixs MailPlugin is


The mail resource object is used to send outgoing mails to mail server. See Java EE spec for details about Java managing mail sessions.

Deployment Descriptors

As the MailPlugin needs to lookup the Java mail resource using a JNDI Lookup you need to provide a valid resource reference to the WorkflowService. Therefore you need to add the mail resource into the ejb-jar.xml to provide the WorkflowService EJB with a valid JNDI resource. See the following ejb-jar.xml example for GlassFish V3


       <!-- Mail Configuration -->
         <description>Mail Plugin Session name</description>
       <!-- Mail resource -->

Note: In other application servers the resource-ref can have a different jndi name. E.g. for JBoss/WildFly need to be full specified: “java:/mail/org.imixs.workflow.mail”