[jboss-user] [jBPM] - HTML support in mail templates
Juvenal Guzman
do-not-reply at jboss.com
Tue Mar 23 13:40:50 EDT 2010
Juvenal Guzman [http://community.jboss.org/people/juvs] replied to the discussion
"HTML support in mail templates"
To view the discussion, visit: http://community.jboss.org/message/533535#533535
--------------------------------------------------------------
Hi,
Some old thread but just in case someone still using jbpm 3 and needs HTML support...
First, need to establish mimeType, but, current Mail class from jBPM don't support this feature, so I create a new class based on Mail jBPM class (see attach file)
The magic is here:
public static void send(Properties mailServerProperties, String fromAddress, List recipients, List bccRecipients, String subject, String text, String mimetype) {
...
if (text != null && mimetype == null) {
message.setText(text);
} else { // Is another mimeType
message.setContent(text, mimetype);
}
...
}
So finally, on your template needs to set mimeType and HTML content (use CDATA for that)
<mail-template name='task-assign'>
<actors>#{taskInstance.actorId}</actors>
<subject>Task '#{taskInstance.name}'</subject>
<mimeType><![CDATA[text/html]]></mimeType>
<text><![CDATA[
<html>
Hi, Task '#{taskInstance.name}' has been assigned to you.
<br>
Go for it, press <a href="#{BaseTaskListURL}#{taskInstance.id}">here</a>
<br>
Thanks.
<br>
<b>---powered by JBoss jBPM---</b>
</html>]]></text>
</mail-template>
Remember to set this new class on your jBPM configuration
<string name='jbpm.mail.class.name' value='com.gucoba.jbmp.mail.MailAction' />
And here comes some nasty, as you know, your current deployed process needs to take this need parameter, so you have two options:
1. Redeploy your process
2. Update process variables on database
See this url for more information http://www.redhat.com/docs/en-US/JBoss_SOA_Platform/4.3.CP02/html-single/JBPM_Reference_Manual/index.html#customizingmailsupport http://www.redhat.com/docs/en-US/JBoss_SOA_Platform/4.3.CP02/html-single/JBPM_Reference_Manual/index.html#customizingmailsupport
Enjoy!
Juvs
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/533535#533535]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100323/022a028d/attachment.html
More information about the jboss-user
mailing list