Are you finding it challenging to get the custom email template in Camunda BPMN in a send mail task?
We also found it challenging and after quite a few trials we found the solution.
What is Camunda?
In case you are new to Camunda, it is an open-source workflow and decision automation tool that helps us build workflow management easily and quickly without much technical knowledge.
You could read more about Camunda and its application at https://camunda.com/
Getting the custom email template in Camunda BPMN in send mail task.
Notify the user via email for the assigned or pending tasks to be completed.
The problem we faced:
While we could integrate the send email for processes via send mail task in camunda, we were finding it difficult to send custom email templates as per companies/client’s branding.
We tried various methods to send the email but every time the mail used to come without body text. In a few cases, we could get the plain text in the email body but that was not fulfilling our objective. We wanted the template to be styled with our client’s branding guidelines.
Steps we took to resolve this issue:
Step1: We did research and found that camunda supports a template engine called “Freemarker” for email templates. We created one freemarker (.ftl) file from our email template in HTML. So camunda will read this .ftl file as the email template in the body part of the email.
Open your HTML in a text editor and save the file in .flt format
Freemarker is pre-installed in the camunda package distribution. Apache FreeMarker™ is a template engine. It is a Java library to generate text output (HTML web pages, e-mails, configuration files, source code, etc.) based on templates and changing data.
You can check more information on Freemarker on the below link:
Step 2: Now save this file in the locations shown below in the camunda project folder. For eg: welcome.ftl
File Location1: <path>/camunda-bpm-tomcat-7.12.0/server/apache-tomcat-9.0.24/lib
File Location2: <path>/camunda-bpm-tomcat-7.12.0/server/apache-tomcat-9.0.24/webapps/camunda/WEB-INF/classes/org/camunda/bpm/tasklist/impl/plugin/resources
Step3: Go to Camunda BPMN and open the send mail task.
Below is the sample for the reference to set up the send email with:
- In the Input/Output parameter, mention html:script in the input parameter
- In the Input Parameter, give Name as html, select Type as a script, script format as freemarker, select Script Type as External Resource, Resource as welcome.html
- Now save this BPMN file and deploy to the server
- Run the email task process to see the final result
I hope this article will be a useful example of resolving “custom email templates in Camunda”.
Stay tuned to read many such useful articles.
Keep yourself safe, environment clean & wash your hands regularly.
#stayhome #staysafe #stopthespread #spreadkindness #socialdistancing #quarantine #stayhealthy
Be First to Comment