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.
Email templates are personalized just like any other template; see Variable Data.
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.
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).
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.
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.
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 Saving 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, the Designer converts all CSS rules that apply to the content of the email to inline style tags, as if local formatting was applied.
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
- Click and hold the mouse button on the style sheet on the Resources pane.
- Move the mouse cursor within the Resources pane to the section to which the style sheet should be applied.
- Release the mouse button.
Using the Includes dialog
- On the Resources pane, right-click the section, then click Includes.
- From the File types dropdown, select Stylesheets.
- 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.
- 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.
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.
The Default section is executed when the template is merged using the Create Email Content task in Workflow (see Workflow Help: Create Email Content).