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}}

Helper tags

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

The following helper tags er supported.

NameDescriptionExample
ifCase based if statement.{{#if_eq customer.CompanyName}}
string is customer name is not "" or empty.
{{/if_eq}}

..you can also combine with else

{{else}}
if-notCase based if-not statement.{{#if_not customer.CompanyName}}
string is customer name is not "" or empty.
{{/if_not}}

..you can also combine with else

{{else}}
switchCase based switch.{{#switch PaymentMethod.PaymentMethodType}}
{{#case "Manual"}}
manual
{{/case}}
{{#case "Token"}}
token
{{/case}}
{{/switch}}
eachFor-each loop when iteration.{{#each Invoice.InvoiceLines}}
{{this.LineNumber}}
{/each}}
formatFormats 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.