# Email templates

If you need to include graphics in the design we recommend using inline base64 images.

CSS is easily embeddable inside style tags

# Inserting data

To insert data from a record,,into an email, the following syntax is used.

`{FIELDNAME}`

### <span class="mw-headline" id="bkmrk-custom-functions-1">Custom functions</span>

A couple of functions are implemented, allowing minor modification of data from fields, before inserting it.

Syntax: `@[FUNCTION]({FIELDNAME} [PARAMETER])`

#### <span class="mw-headline" id="bkmrk-function%3A-fallback-1">Function: FALLBACK</span>

Sample: `@FALLBACK({NAME} Friend)`

If the given field does not have a value, or is not found, the PARAMETER value will be used instead.

#### <span class="mw-headline" id="bkmrk-function%3A-dateadd-1">Function: DATEADD</span>

Sample: `@DATEADD({DATE} 3 weeks)`

If the given field is a Date, Time or DateTime field, the value is modified by the given amount (positive or negative)

Supports wrapping inside FORMAT (see below).

Supported periods: minute(s), hour(s), day(s), week(s), month(s), year(s)

#### <span class="mw-headline" id="bkmrk-function%3A-datesub-1">Function: DATESUB</span>

Sample: `@DATESUB({DATE} 3 weeks)`

If the given field is a Date, Time or DateTime field, the value is modified by the given amount (positive or negative)

Supports wrapping inside FORMAT (see below).

Supported periods: minute(s), hour(s), day(s), week(s), month(s), year(s)

#### <span class="mw-headline" id="bkmrk-function%3A-format-1">Function: FORMAT</span>

Sample: `@FORMAT({NUMBER} 000.000)` or `@FORMAT({DATE} MMM, d YYYY)`

Formats a given number or date to the specified format.

Number formatting uses [DecimalFormat](https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html) and date formatting uses [SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html).

It is possible to wrap this function around DATESUB and DATEADD like this: `@FORMAT(@DATEADD({DATE} 3 weeks) MMM, d YYYY)`

# System templates

Templates can be changed in the designer: **Modules &gt; Configuration**

### <span class="mw-headline" id="bkmrk-invitation-template-1">Invitation template</span>

HTML can be edited in **Template.WelcomeUser** and **Template.WelcomeUserLink**

Supported tags

- {APPLICATION}
- {LOGINURL}
- {USERNAME}
- {PASSWORD}

### <span class="mw-headline" id="bkmrk-password-reset-templ-1">Password reset template</span>

HTML can be edited in **Template.PasswordReset** and **Template.PasswordResetLink**

Supported tags

- {LOGINURL}
- {PASSWORD}

### <span class="mw-headline" id="bkmrk-reset-via-link-templ-1">Reset via link-templates</span>

Additional supported tags

- {PASSWORDLINK}
- {LINKLIFETIME}

# Wrapping emails

It is possible to wrap all emails sent by the system in an [MJML](https://mjml.io/try-it-live/) or HTML wrapper.

Our implementation of the MJML engine is a bit unstable, so it is recommended to build the wrapper using MJML, then exporting the HTML version and uploading that to the platform.

Two tags are available: `[SUBJECT]` and `[BODY]`

SUBJECT will be replaced with the subject of the given email.

BODY will be replaced with the email-content of the given email.

To enable email-wrapping, set the Policy `defaultEmailTemplateID` to the ID of the template.

You can control whether the content of the email is inserted into the template before or after rendering, via the Policy `emailDoInsertBeforeRender`.