• Emails
Search »

Email Patterns

Now onto something a little more technical. This page gets a little advanced, so be warned!

As you've probably seen, the HTML template and Text template fields on the content tab each have a corresponding "Examples" dropdown. These options are known as "email patterns" [N.B. we would have called these "email templates", but that term is already in play and "email template templates" sounds positively glutinous].

The following page explains how to build your own email patterns so that they get listed in that dropdown - letting you quickly construct emails based on your OWN templates. This can save precious time and effort if you're in the position of needing to add email templates quite frequently and would like things like a header and footer inserted to match your site.

The email patterns are stored in your /global/emails/patterns folder. When you browse the folder, you'll see a bunch of .tpl files (Smarty template files) and a patterns.ini file. The patterns.ini file contains various meta information about the patterns: a descriptive name of each, which section they should appear in the dropdown and whether they should appear in the text or HTML dropdowns.

So far so good.

The Smarty Parser

As with all other HTML and code generation in Form Tools, email content is generated by being passing through the Smarty parser.

When the administrator selects the email pattern from the dropdown field, it magically inserts the content into the textarea. At a superficial glance, they can see the content contains weird characters like {$QUESTION_email}, which they can correctly deduce get converted into the appropriate meaning when the email is  sent. In other words, the content gets sent through the Smarty parser.

Well, that's only HALF the story. Before the content appears in the field, the content has ALREADY passed through the parser. This lets us customize the "All fields" templates to generate HTML and text containing placeholders that are unique to your individual form.

This is probably pretty confusing, so here's a couple of examples to clear things up.


Consider the following email template, called html_admin_full_form_submission.tpl. This is what it looks like

When you select it in the UI, it becomes:

How to process

So now you know the issues involved with creating email patterns. Remember to escape in {literal} tags and Smarty placeholders/logic that you want to appear in the visible HTML/text. All other un-escaped Smarty content will be processed by the parser BEFORE the content appears in the HTML template and text template fields.

After creating your new email pattern, edit the patterns.ini file.