Email templates

Email templates (also called Email sections) are part of the Email context in a template. The Email context outputs HTML email with embedded formatting to an email client through the use of an email server. Since email clients are numerous and do not support same features, the HTML generated by this context is not optimized for any specific client - rather, it's meant to be compatible with as many clients and as many devices as possible.

In Email templates, many content elements can be used; see Content elements. However, special attention must be paid to the way elements are positioned. In Email sections, it is advisable to position elements using Tables and to put text in table cells (see Designing an Email template).

Email templates are personalized just like any other template; see Personalizing content.

The subject, recipients (To, CC and BCC), sender and reply-to address are specified with Email Script Wizards; see Email header settings.

An Email context can contain multiple templates. When generating output from the Email context, however, only one of the Email templates can be merged with each record. Set the 'default' Email section (see below) before generating Email output; see also Generating Email output.

For information about attachments see Email attachments.
A plain-text version of the HTML is added to each email if the option is checked in the Email section's properties (see Properties tab). With new templates this is always the case.

Adding an Email template

When an Email template is created (see Creating an Email template with a Wizard), only one Email section is added to it. An Email context may contain various templates, but per record only one of those can be sent when you generate Email output.

It is not possible to add an Email section to an existing Email context with the help of a Template Wizard.

To provide alternative content for your email, you could use Conditional Content (see Showing content conditionally), or Snippets and a script (see Snippets and Loading a snippet via a script).

If you would like to start with a template that is identical to the one you already have, consider copying it (see Copying a section). If it's inside another template you can import it (see below).

To add a section to the Email context:

  • On the Resources pane, expand the Contexts folder, right-click the Email folder, and then click New Email.

Importing an Email template

To import an Email section from another template, click File > Import Resources... in the menu. See: Import Resources dialog.
Remember also to add or import any related source files, such as images.

Note that when the imported Email section replaces an Email section in your template, the PDF attachments settings are imported as well. (See: Compressing PDF attachments.)

Deleting an Email template

To delete an Email section:

  • On the Resources pane, expand the Contexts folder, expand the Email context, right-click the name of the section, and then click Delete.

Caution: If you don't have a backup of the template, the only way to recover a deleted section, is to click Undo on the Edit menu, until the deleted section is restored. After closing and reopening the template it is no longer possible to restore the deleted context this way.
In the Saving Preferences you can set whether a backup file should be created when you save the template; see Save preferences.

Styling and formatting an Email template

The contents of an Email section can be formatted directly, or styled with Cascading Style Sheets (CSS). See Styling and formatting.

Email clients do not read CSS files and some even remove a <style> tag when it is present in the email's header. Nevertheless, CSS files can be used with the Email context in the Designer.
When generating output from the Email context, all CSS rules that apply to the content of the email can be processed and added either to the header of the email or to inline style properties as if local formatting was applied, depending on the Email section properties. See Email section properties.

Tip: Before you can style an element, you have to select it. In an Email context it can be difficult to select an element by clicking on it. Use the breadcrumbs at the top and the Outline pane at the left, to select an element. See Selecting an element.

In order for a style sheet to be applied to a specific section, it needs to be included in that section. There are two ways to do this.

Drag & drop a style sheet

  1. Click and hold the mouse button on the style sheet on the Resources pane.

  2. Move the mouse cursor within the Resources pane to the section to which the style sheet should be applied.

  3. Release the mouse button.

Using the Includes dialog

  1. On the Resources pane, right-click the section, then click Includes.

  2. From the File types dropdown, select Stylesheets.

  3. Choose which CSS files should be applied to this section. The available files are listed at the left. Use the arrow buttons to move the files that should be included to the list at the right.

  4. You can also change the order in which the CSS files are read: click one of the included CSS files and use the Up and Down buttons. Note that moving a style sheet up in the list gives it less weight. In case of conflicting rules, style sheets read later will override previous ones.

Note: Style sheets are applied in the order in which they are included in a section. The styles in each following style sheet add up to the styles found in previously read style sheets. When style sheets have a conflicting rule for the same element, class or ID, the last style sheet ‘wins’ and overrides the rule found in the previous style sheet.

Note: Style sheets that are linked to (i.e. included in) a section show a chain icon in the Resources pane (see Resources pane).

Setting a default Email template for output

An Email context can contain multiple templates. When generating output from the Email context, however, only one of the Email templates can be merged with each record.

To select the Email section that will be output by default:

  • On the Resources pane, expand the Email context, right-click a section and click Set as Default.

By default, the Create Email Content task in Workflow selects the default Email section with the data (see Workflow Help: Create Email Content).

Tip: Use a Control Script to dynamically select an Email section for output depending on the value of a data field.