Can't generate an HTML email using "Camunda Send Mail Connector" & Freemarker Template

Hello community,

I am trying to send a mail with HTML content using the Mail Connector for Camunda.

After configuring the connector, I manage to send a mail with a simple text content from a Camunda Process.

Now, I am trying to send a mail using a Freemarker template with a static content as a first step.

Below the configuration I am using for the connector in process.bpmn :

            <camunda:inputParameter name="to">${''}</camunda:inputParameter>
            <camunda:inputParameter name="subject">${'testCamunda: '}</camunda:inputParameter>
            <camunda:inputParameter name="html">
              <camunda:script scriptFormat="freemarker" resource="templates/body-mail.ftl" />

Below the static freeMarker template I am using (I am qualifying the template as static because I am not referencing any variable in it for now). The template is located in ressources/templates/body-mail.ftl :

    Hello World !
 <p>  This mail has been sent from a Camunda process ! </p>

With the configuration above, the connector is sending an empty body mail ! It’s like the template engine is completely ignoring the content of the template body-mail.tfl. I don’t see any errors or warnings in Camunda logs (Tomcat logs). The template is not ignored because when I change the name of the tfl file, Camunda raises a Not Found Exception.

Did I miss something in the definition of the Freemarker template ?

I am using Camunda 7.9.0 and camunda-bpm-mail-core-1.1.0

Thank you in advance for your help, advice and suggestions :slight_smile:

Best regards,

Hi @Hel,

thank you for raising this up. Can you provide the full message including the metadata from your mail client?

If a HTML body is set then it send the mail with a multi-part body. The HTML body part is of type text/html; charset=utf-8 .
What happens if you add a text body as fallback to the HTML body?

Best regards,

Hi @Philipp_Ossler,

Thank you for your reply :slight_smile:

Here is the metadata from my mail client (Outlook 2016).

Received: from MY_COMPUTER_DOMAIN by

 MY_COMPANY_DOMAIN (IP) with Microsoft SMTP Server

 id 14.3.408.0; Fri, 26 Oct 2018 15:40:10 +0200

Date: Fri, 26 Oct 2018 15:40:10 +0200

From: MyCamundaEmailAdress

To: MyEmail

CC: MyEmail2

Message-ID: &lt;1712434077.1.1540561210928@MY_COMPUTER&gt;

Subject: testcamunda:

MIME-Version: 1.0

**Content-Type: text/plain**

Return-Path: MyCamundaEmailAdress

X-MS-Exchange-Organization-AuthSource: MY_COMPANY_DOMAIN

X-MS-Exchange-Organization-AuthAs: Internal

X-MS-Exchange-Organization-AuthMechanism: 0a

X-Originating-IP: [IP]

X-KSE-AntiSpam-Interceptor-Info: XXXX

X-MS-Exchange-Organization-AVStamp-Mailbox: XXXX

X-KSE-Antivirus-Interceptor-Info: scan successful

X-KSE-Antivirus-Info: Clean

I don’t understand why the content type was not set to text/plain value. I though that specifying the input parameter “html” for the connector was enough to say that I want an html email…

Finally, I managed to resolve the problem (without knowing how !) by aborting my project and creating a new one with a new tfl file. Now it works perfectly!

I am sorry for my delayed reply. I just come to know that my reply was not published on time!

1 Like