Camunda Mail Connector using Freemarker template

I am using Camunda mail connector and when I start a process I set some variables.
And in the Send Task (Email),I want to add the variable to Mail Body using free marker template.
But the variable value is not getting set.
Any ideas on this?

@Mass_Shake in freemarker template you have to mention the variables as ${variablename} or execution.getVariable("variablename") ,so those variables will be resolved at runtime from the execution context

I am getting this error.

freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> VAR_EXTERNAL_ID [in template “unknown” at line 1, column 6]

This is how I start the process.

I pass the varibales from here.

mail.bpmn (8.7 KB)
This is my BPMN file

@Mass_Shake in the send task you have used the constant, freemarker will not be aware of those constants, use the exact variable name.


Lets say you have defined a field like this, public final static String VAR_INCIDENT_ID="incidentId"; then you have to configure incidentId in the template.

The constant is public final static String VAR_INCIDENT_ID=“VAR_INCIDENT_ID” and hence I am using ${VAR_INCIDENT_ID}

@Mass_Shake, noticed that from is missing in your connector config. If you have configured the from attribute in file, then not required to set it in connector input parameters.

Check this example in the section mail-send:

Also make sure dependency in classpath:

<!-- freemarker -->

I have referred to the same example.
Also the dependency is there.

Can we pass entire JSON object while starting the process?
And access the json in free marker template

you can use, but fields are need to be accessed like this : ${user.userId} in freemarker template

Similar to that github example i created sample flow which works fine for me, i was able to test it.

sendTaskTest.bpmn (4.7 KB)


1 Like

did you configured “from” attribute in either mail-config.properites or input param in connector config of send task?


How did you pass the JSON to process engine.?

Yes ,I have configured it in

in, the property should be mail.sender not from

Refer this link: