Skip to content

Commit cfb0a56

Browse files
committed
documentation (Issue #910)
1 parent 49554d9 commit cfb0a56

File tree

1 file changed

+114
-99
lines changed

1 file changed

+114
-99
lines changed
Lines changed: 114 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,59 @@
1-
# MailPlugin
1+
# MailPlugin
2+
23
The Imixs-MailPlugin provides a convenient way to send e-mail messages through a corresponding BPMN event.
34
The Imixs-MailPlugin is based on the Java Mail API and can be activated by adding the plugin class to the corresponding model definition.
45

56
_Plugin Class Name:_
67

78
org.imixs.workflow.engine.plugins.MailPlugin
89

9-
Sending an E-Mail can be configured by the corresponding BPMN event using the [Imixs-BPMN modeling tool](../../modelling/activities.html) in various ways.
10-
11-
<img src="../../images/modelling/bpmn_screen_23.png"/>
10+
Sending an E-Mail can be configured by the corresponding BPMN event using the [Imixs-BPMN modeling tool](../../modelling/activities.html) in various ways.
1211

13-
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.
12+
<img src="../../images/modelling/bpmn_screen_23.png"/>
1413

14+
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.
1515

1616
## The Mail Content
1717

18-
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 imixs.properties file.
18+
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 imixs.properties file.
1919

2020
See the following plain text example:
2121

22-
2322
Dear <itemValue>firstName</itemValue> <itemValue>lastName</itemValue>,
24-
25-
A new task needs your attention. Please click on the following link to see further information:
26-
<propertyvalue>application.url</propertyvalue>index.jsf?workitem=<itemvalue>$uniqueid</itemvalue>
27-
28-
In case of questions or problems, please contact the Workflow team.
2923

24+
A new task needs your attention. Please click on the following link to see further information:
25+
<propertyvalue>application.url</propertyvalue>index.jsf?workitem=<itemvalue>$uniqueid</itemvalue>
26+
27+
In case of questions or problems, please contact the Workflow team.
3028

3129
<br />
3230

3331
### HTML E-Mail
3432

35-
The Mail body can contain plain text or HTML.
36-
A HTML Mail must start with the tags <!doctype...>" or <html...>. Also a html mail can be combined with values from the current workitem.
33+
The Mail body can contain plain text or HTML.
34+
A HTML Mail must start with the tags <!doctype...>" or <html...>. Also a html mail can be combined with values from the current workitem.
3735

3836
See the following HTML example:
3937

40-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
41-
<html xmlns="http://www.w3.org/1999/xhtml">
42-
<head>
43-
<meta name="viewport" content="width=device-width" />
44-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
45-
<title>Workflow Message</title>
46-
<style>
47-
/* optional css definition */
48-
</style>
49-
</head>
50-
51-
<body bgcolor="#f6f6f6">
52-
53-
<!-- body -->
54-
<div class="container" bgcolor="#FFFFFF">
55-
<!-- content -->
56-
<div class="content">
57-
<h1>Dear <itemValue>firstName</itemValue> <itemValue>lastName</itemValue>, </h1>
58-
<p>A new task needs your attention.</p>
38+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
39+
<html xmlns="http://www.w3.org/1999/xhtml">
40+
<head>
41+
<meta name="viewport" content="width=device-width" />
42+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
43+
<title>Workflow Message</title>
44+
<style>
45+
/* optional css definition */
46+
</style>
47+
</head>
48+
49+
<body bgcolor="#f6f6f6">
50+
51+
<!-- body -->
52+
<div class="container" bgcolor="#FFFFFF">
53+
<!-- content -->
54+
<div class="content">
55+
<h1>Dear <itemValue>firstName</itemValue> <itemValue>lastName</itemValue>, </h1>
56+
<p>A new task needs your attention.</p>
5957
....
6058
</body>
6159
</html>
@@ -70,72 +68,94 @@ To activate the template mode, a valid XSL document need to put into the mail bo
7068

7169
See the following XSL Template example:
7270

73-
<?xml version="1.0" encoding="UTF-8" ?>
74-
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
75-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
76-
<xsl:output method="html" media-type="text/html" indent="no"
77-
encoding="ISO-8859-1" />
78-
<xsl:template match="/">
79-
<html>
80-
<body>
81-
<h1>Welcome</h1>
82-
<h2>
83-
<xsl:value-of select="document/item[@name='txtname']/value" />
84-
</h2>
85-
</body>
86-
</html>
87-
</xsl:template>
88-
</xsl:stylesheet>
89-
90-
71+
<?xml version="1.0" encoding="UTF-8" ?>
72+
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
73+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
74+
<xsl:output method="html" media-type="text/html" indent="no"
75+
encoding="ISO-8859-1" />
76+
<xsl:template match="/">
77+
<html>
78+
<body>
79+
<h1>Welcome</h1>
80+
<h2>
81+
<xsl:value-of select="document/item[@name='txtname']/value" />
82+
</h2>
83+
</body>
84+
</html>
85+
</xsl:template>
86+
</xsl:stylesheet>
9187

9288
<br />
9389

9490
## Configuration
9591

9692
Further configuration is supported by the Imixs-MailPlugin.
9793

94+
### Default Sender Address
9895

96+
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.
9997

100-
### Default Sender Address
101-
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.
102-
10398
Example (imixs.properties):
10499

105-
# Marty Mail Plugin
106-
mail.defaultSender=info@imixs.com
100+
# Mail Plugin
101+
mail.defaultSender=info@foo.com
107102

108-
A subclass of the MailPlugin can change the behavior by overwriting the method 'getFrom()'
109-
103+
A subclass of the MailPlugin can change the behavior by overwriting the method `getFrom()`
110104

111-
### Testing Mode
112-
During development you can switch the Imixs-MailPlugin into a Testing-Mode by defining the imixs property:
105+
### ReplyTo Address
113106

114-
mail.testRecipients
115-
116-
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: '.
107+
You can set a explizit replyTo address by setting the imixs.property `mail.replyTo`.
117108

118-
Example (imixs.properties):
109+
# Mail Plugin
110+
mail.replyTo=marketing@foo.com
111+
112+
A subclass of the MailPlugin can change the behavior by overwriting the method `getReplyTo()`
113+
114+
### Authenticated Sender
115+
116+
You can overwrite the `authenticatedSender` which may be necessary in case of DMARC (Domain-based Message Authentication, Reporting, and Conformance).
117+
118+
DMARC checks to see if the email's sender address is actually authorized to send emails for that domain. A conflict can occur if:
119+
120+
1. From address: info@foo.com (customer domain)
121+
2. Actual sender: webmaster@my-company.com (your domain)
122+
123+
For DMARC authentication to be successful, at least two conditions must be met:
119124

120-
#Testmode
121-
mail.testRecipients=test@development.com
125+
1. SPF (Sender Policy Framework): The server from which the email is sent must be authorized in the SPF records of the sender domain.
126+
2. DKIM (DomainKeys Identified Mail): The email must be signed with a private key of the sender domain.
122127

128+
You can set the authenticated sender in Imixs-Workflow by setting the property `mail.authenticatedSender` to the same address as the configured mail host.
123129

130+
# Mail Plugin
131+
mail.authenticatedSender=marketing@foo.com
124132

133+
### Testing Mode
134+
135+
During development you can switch the Imixs-MailPlugin into a Testing-Mode by defining the imixs property:
136+
137+
mail.testRecipients
138+
139+
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: '.
140+
141+
Example (imixs.properties):
142+
143+
#Testmode
144+
mail.testRecipients=test@development.com
125145

126146
### CharSet
147+
127148
The default character-set used for the mail subject and body parts is set to 'ISO-8859-1'.
128-
It is possible to switch to a specific character set . There for the imixs.property key 'mail.charSet' can be used.
149+
It is possible to switch to a specific character set . There for the imixs.property key 'mail.charSet' can be used.
129150

130151
Example (imixs.properties):
131152

132-
#Charset
133-
mail.charSet=UTF-8
134-
153+
#Charset
154+
mail.charSet=UTF-8
135155

136156
### Cancel e-mail
137157

138-
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.
158+
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.
139159

140160
keyMailInactive=true
141161

@@ -144,22 +164,19 @@ The attribute can be set by the [Imixs-RulePlugin](./ruleplugin.html).
144164
### Receipients and Event Properties
145165

146166
A E-Mail message consists of a list of recipients. The recipients can be mapped to name-fields defined in the BPMN definition.
147-
148-
The following event properties are supported:
149-
150-
151-
|Name |Type | Description |
152-
|----------------------|-----------|-----------------------------------------------|
153-
| txtMailSubject | String | Mail Subject |
154-
| rtfMailBody | String | Mail Body (can be plain text or HTML) |
155-
| namMailReplyToUser | String | Reply To address. If not set the reply address is the sender address |
156-
| namMailFrom | String | Sender (default is the current user) |
157-
| namMailReceiver | String (list) | Receiver list (TO) |
158-
| namMailReceiverCC | String (list) | Receiver list (CC) |
159-
| namMailReceiverBCC | String (list) | Receiver list (BCC) |
160-
| keyMailInactive | Boolean | If true, the e-mail will be canceled (can be set by other plugins) |
161167

168+
The following event properties are supported:
162169

170+
| Name | Type | Description |
171+
| ------------------ | ------------- | -------------------------------------------------------------------- |
172+
| txtMailSubject | String | Mail Subject |
173+
| rtfMailBody | String | Mail Body (can be plain text or HTML) |
174+
| namMailReplyToUser | String | Reply To address. If not set the reply address is the sender address |
175+
| namMailFrom | String | Sender (default is the current user) |
176+
| namMailReceiver | String (list) | Receiver list (TO) |
177+
| namMailReceiverCC | String (list) | Receiver list (CC) |
178+
| namMailReceiverBCC | String (list) | Receiver list (BCC) |
179+
| keyMailInactive | Boolean | If true, the e-mail will be canceled (can be set by other plugins) |
163180

164181
## Deployment
165182

@@ -171,17 +188,15 @@ The mail resource object is used to send outgoing mails to mail server. See Java
171188

172189
### Deployment Descriptors
173190

174-
Depending on the server environment the Mail resource need also be defined in the deployment descriptor. See the following example for JBoss/Wildfly Server:
175-
176-
177-
<?xml version="1.0" encoding="UTF-8"?>
178-
<jboss-web>
179-
....
180-
<resource-ref>
181-
<res-ref-name>mail/org.imixs.workflow.mail</res-ref-name>
182-
<res-type>javax.mail.Session</res-type>
183-
<jndi-name>java:/mail/org.imixs.workflow.mail</jndi-name>
184-
</resource-ref>
185-
....
186-
</jboss-web>
187-
191+
Depending on the server environment the Mail resource need also be defined in the deployment descriptor. See the following example for JBoss/Wildfly Server:
192+
193+
<?xml version="1.0" encoding="UTF-8"?>
194+
<jboss-web>
195+
....
196+
<resource-ref>
197+
<res-ref-name>mail/org.imixs.workflow.mail</res-ref-name>
198+
<res-type>javax.mail.Session</res-type>
199+
<jndi-name>java:/mail/org.imixs.workflow.mail</jndi-name>
200+
</resource-ref>
201+
....
202+
</jboss-web>

0 commit comments

Comments
 (0)