This section is mostly for developers

Table of Contents


The purpose of Mandaa EUmail is to send transactional emails to end users or customers. Transactional emails are often mails with account activation, order confirmations and invoices, account statements, delivery information etc. 

These emails are usually sent to a single recipient and only as a result of some event that the user/customer has requested. Transactional emails will usually include some information specific to the user/customer and the situation. 

You provide this information from your system when you call the EUmail API and EUmail will merge it into your template before sending the email.

EUmail implements a modified set of “instructions” based on the Handlebars library. 

By this we mean that most of the instructions defined in the Handlebars library will work as in other applications using the same library, while we have chosen to improve others in EUmail.

Usually this means that the standard Handlebar instruction will work, but we have added an improved version also. 

merge data + template = final email 

Sample merge data

					mergedata": {
    "firstname": "Jane",
    "lastname": "Doe",
    "is_cheese": true,

Simple substitution

Simple substitution is the most basic form of substitution – or the use of variables. 

Example template:

					Hello {{firstname}}

Example data:

					{"firstname":"Jane Doe"}

Result output:

					Hello Jane Doe


 Use triple handlebars to escape parsing of the merge-data. You can use this to include any HTML without it being interpreted. 


Conditions - IF

Conditions will allow you to control the content in your dynamic template based on the value of your merge data. 

					{{#if is_cheese}}
Show this paragraph when variable is_cheese is true
					{{#if cheese=="havarti"}}
Show this paragraph if cheese equals havarti
					{{#if cheese=="havarti"}}
Show this paragraph if cheese equals havarti
Show this if cheese is not havarti

Conditions - Unless

					{{#unless is_cheese}}
Show this paragraph when is_cheese is false

Loops - Each

With Each You can iterate (loop) over lists in you merge data to generate a liste of items in the output. The keyword this refers to the current element in the list.

					# Template 
{{#each cheeses}}

					# Merge data 
					# Output

You can use the optional else tag to handle the situation where there is no elements in the list.

					{{#each sections}}
<p>The sections list is empty</p>


If you need to know the current number of the list you can you the @index tag. The first element in the list has index no zero (“0”).

					{{#each sections}}
<p>Number: {{@index}}, value = {{this}}</p>