Search…
Mail
Mail is the functionality in Valtimo for sending emails by using a third party email API.

How to setup

Before emails can be send, Valtimo needs to be connected to a third party email API. Several third party email API's are available:

How to configure a task for sending mails

After configuring the connection you can send mails from a BPMN model. Generally the best way to do this is to create a Service Task and configure this with implementation type Expression.

Expression

In order to set the expression, selected the Service Task and select Expression as implementation type. Then enter the expression as described below.
In this example the following expression is used:
1
${mailService.sendElementTemplateTaskMail(execution)}
Copied!
A bean is available with the name mailService. You can use this bean to call the sendElementTemplateTaskMail method.
1
fun sendElementTemplateTaskMail(
2
execution: DelegateExecution
3
)
Copied!
Argument
Description
execution
This is the Camunda execution object. This can always be passed in in a BPMN model expression by using the execution variable.

Settings

Several setting can be set in the Extensions tab in the Camunda modeller for the Service Task. Example:
The following settings are available:
Argument
Description
mailSendTaskTemplate
A reference to the template that should be used for the email
mailSendTaskFrom
The emailadress of the email sender
mailSendTaskTo
The emailadress of the email recipient
mailSendTaskSubject
The subject of the email
Processvariables can be used for all settings with the following notation: ${my-process-var}. For example:

How to pass variables to the email template

If the email template contains placeholders, these placeholders can be filled with the following variables:
Argument
Description
business-key
The business key from the process that sends the email
var
An object containing all variables from the process. Any process variable can be accessed by placing a dot between var and the process variable. For example:
var.my-process-var
Depending on the third party, the notation for adding placeholders to the email template can be different. Please refer to the third party documentation on how to add these.

Passing dossier properties to the mail template

It's not possible to pass properties from the dossier directly to the mail template. But it is possible to do it inderectly. The correct method is turn the dossier property into a process variable which will then automatically be passed to the mail template. Example:
In this example the following expression is used:
1
${execution.setVariable("status",documentVariableDelegate.findValueByJsonPointer("/project/status",execution))}
Copied!