Merging e-mail content

E-mail templates can be edited in pure HTML allowing full customization options and freedom of design. Content elements are presented on the side of the e-mail template editor. These content elements are referred as tags.

Tags replace content from the various objects in the database and are formatted using handlebars {{somename}}.

<table width="100%" border="1" cellspacing="5" cellpadding="5">
    <tr>
      {{#if_eq customer.CompanyName}}
      <td>{{customer.CompanyName}} let's you show only the customer company name if it exists</td>
      {{/if_eq}}
      
      {{#if_eq customer.CompanyName}}
      <td>{{customer.FullName}} if the customer has no company name, show the full name instead</td>
      {{/if_eq}}
      
      {{#if_eq customer.BillToParent "True"}}
      <td>This is only shown when Bill To Parent is true on customer</td>
      {{/if_eq}}

      {{#switch PaymentMethod.PaymentMethodType}}
              {{#case "Manual"}}
                             <td>This is a manual payment method</td>
              {{/case}}
              {{#case "Token"}}
                             <td>This is a credit card payment method</td>
              {{/case}}
      {{/switch}}
    </tr>
    <tr>
    </tr>
  </table>

An example on how to iterate through various invoice-lines is shown below.

{{#each Invoice.InvoiceLines}}
  <div class="row">
    {{this.LineNumber}}
  </div>
{{/each}}

👍

Root level objects

While you're inside the #each you can go up a level with ../
For example: {{../Customer.CompanyName}}

Helper tags

To allow more customizable options for formatting number, dates and providing basic if/if not options.

The following helper tags er supported.

Name

Description

Example

if

Case based if statement.

{{#if_eq customer.CompanyName}}
customer name is not "" or empty.
{{/if_eq}}

..you can also combine with else

{{else}}

.. or compare with a value

{{#if_eq customer.CompanyName "John Doe"}}
customer name is John Doe
{{/if_eq}}

.. or compare with empty

{{#if_eq customer.CompanyName ""}}
customer name is empty or null
{{/if_eq}}

if-not

Case based if-not statement.

{{#if_not customer.CompanyName}}
customer name is not "" or empty.
{{/if_not}}

..you can also combine with else

{{else}}

.. or compare with a value

{{#if_not customer.CompanyName "John Doe"}}
customer name is not John Doe.
{{/if_not}}

.. or compare with empty

{{#if_not customer.CompanyName ""}}
customer name is not empty or null
{{/if_not}}

switch

Case based switch.

{{#switch PaymentMethod.PaymentMethodType}}
{{#case "Manual"}}
manual
{{/case}}
{{#case "Token"}}
token
{{/case}}
{{#case else}}
else case
{{/case}}
{{/switch}}

each

For-each loop when iteration.

{{#each Invoice.InvoiceLines}}
{{this.LineNumber}}
{{/each}}

with

Evaluation context

{{#with Company}}
{{FullName}}
{{/with}}

unless

Unless statement as an inverse if.

{{#unless Customer.FullName}}
{{/unless}}

format

Formats the value (number or date) using an input.

See this external documentation for syntax of numbers.

See this external documentation for syntax of dates.

{{format Invoice.InvoiceDate "dd-MM-yy"}}

{{format Invoice.InvoiceDate "ddd. MMM yyyy"}}

{{format Invoice.TotalAmount "N"}}

{{format Invoice.TotalAmount "C"}}

{{format Invoice.TotalAmount "0.00"}}

Questions?

We're always happy to help with code or other questions you might have! Search our documentation or contact helpdesk. You can also chat live with us using the Intercom icon.