SmartTemplates

ATTENTION: This information is based on the latest Add-on version.
Maybe your installed version didn't contain all the variables listed here, please refer add-on help for further details!
From 0.9.3 and onward we have a new logic of our Variables, please use the NEW ones from now instead of the OLD ones!

Common

TIP: Some variables cannot be used when composing new mails; a message will be displayed should you chose one accidentally.

variable can be used always, including New E-Mails
variable can be used in New Emails, creating a clickable field
variable can only be used in Forward / Reply cases

Obsolete Variables

Identity

fieldId: For additional field values, see chapter 'Address Book Fields' below.

Example:

Phone No: %identity(addressbook,workphone)% 

The 'addressbook' variables also support using the optionality syntax [[ ... ]] in order to omit a section of text or html if the particular addressbook field is empty. The following line will be omitted if State information is not available from the address book for the current identity.

[[State: %identity(addressbook,work.state)%]]

Fixed variables

The actual display of email addressing variables such as %to% can be configured in Advanced Settings in the box 'Default address format'.

Recipient (To)

In replies / forwarded mails, these variables refer to headers from the original email, so if you reply to an email it will show your own address info. When you write a new email this variable will be displayed as a placeholder for your "final recipient" and can be updated by clicking on it once you have entered a "To:" address above.
To always insert the final recipient of your mail regardless on where you use it (Write, Reply, Forward), use %recipient% instead.

TIP: When the name is not available, email address will be displayed instead

Sender (From)

In replies / forwarded mails, these variables refer to headers from the original email, so if you reply to an email it will show the original sender's address info. Only when you write a new email this variable will be replaced with your own from address.
To always insert your own information in a template regardless on where you use it (Write, Reply, Forward), use %identity% instead.

TIP: When the name is not available, email address will be displayed instead

Recipient (CC)

In replies / forwarded mails, these variables refer to cc parts from the original email. If you use it in a new email this variable will be displayed as a placeholder for anybody you CC and will be updated once you click it - probably not a useful application in a real example as the idea of CC is hiding recipients.

Address Book Fields

When replying to a matching email address you can now use additional fields for address variables like %from%:

Contact

  • firstname
  • lastname
  • name
  • nickname
  • additionalmail
  • chatname
  • workphone
  • homephone
  • fax
  • pager
  • mobile

Private

  • private.city
  • private.address1
  • private.address2
  • private.state
  • private.country
  • private.zipcode
  • private.webpage

Work

  • work.title
  • work.department
  • work.organization
  • work.address1
  • work.address2
  • work.city
  • work.state
  • work.country
  • work.zipcode
  • work.webpage

Other

  • other.custom1
  • other.custom2
  • other.custom3
  • other.custom4
  • other.notes

Optional Sections

ATTENTION: Sections inside square brackets, like:

 [[Cc: %cc(name)%]]
will only be displayed if the variable %cc(name)% can be found in the header and replaced successfully!

This can be either of these 2:

To: Alex Cc: Fred 
  OR
To: Alex
- if Cc is missing, everything within the brackets will be omitted.

The following variables can be used inside square brackets [[...]]:

any_AB_field := see chapter 'Address Book Fields'.

Subject

Special Headers

Signature (read from Account Settings)

By Default you can place the Signature by Account Settings in Thunderbird.

Account settings for signature

and remove the Signature delimiters '--' by our Global settings Tab.

Signature delimiter

But with follow variables you can override this positioning and use the variable with or without the delimiters.

Language functions

%spellcheck(language)% = change automatic proofing / spellcheck language. The language parameter can be any locale string of a dictionary that is already installed, e.g. en, de, en-GB etc. Examples for language: cs, de, en-US, es-ES, fi, fr, id-ID, it, ja, nl, oc, pl, pt-BR, ru.
Additional dictionaries can be installed from addons.thunderbird.net using Add-ons Manager. See also [issue 17]

You can also toggle spellcheck using %spellcheck(on)% or %spellcheck(off)%. Normally the global Thunderbird setting under Composition / Spelling "Enable Spellcheck as you type" will apply. To toggle (on or off) and set the language, write the toggle command first.

Example:

  %spellcheck(on)%
  %spellcheck(de)%
This turns on automatic proofing and switches the spellchecker language to German.

%language(localeId)% Requests a language for certain Calendar functions.

The functions %A% %a% %B% %b% retrieve day / month names from the locales supplied with SmartTemplates
localeId = [cs, de, en-US, es-ES, fi, fr, id-ID, it, ja, nl, oc, pl, pt-BR, ru, sl, sr, sv-SE, uk, zh-CN, zh-TW]

The functions %dateshort% %datelocal% and also dateformat (see its documentation here) resolve their date formats from the currently installed language packs - see the Languages tab in Add-on Manager to see available locales.

In case of problems / unexpected language results, check the JavaScript error console for details. This can be opened with the shortcut CTRL+SHIFT+J or via Error Console in the Tools - Developer Tools Menu in Thunderbird.

In order to download additional language packs for Thunderbird, please go to https://ftp.mozilla.org/pub/thunderbird/releases/ then find a matching version for your Thunderbird / OS, then open the xpi folder for language packs.
Example: https://ftp.mozilla.org/pub/thunderbird/releases/60.8.0/win64/xpi/ contains matching language packs for Thunderbird 68.8.0 for Windows 64bit and can be dragged directly into the Add-ons Manager.

Combined variables for 'Date format' / 'Timezone'

TIP: Can be combined with %X:=sent%

Variables for customized 'Date format'

TIP: Can be combined with %X:=sent%

Calendar Week (based on ISO 8601)

TIP: %cwIso(offset)% the 'offset' represents what you count as first day of the week. Typically, in Europe you would probably use %cwIso(1)% (for Monday), in Northern America %cwIso(0)% (for Sunday)

The %X:=sent% Modifier

By Default, Date/Time variables will always be initialized with current values (current = the time when you create the email).
When combined with %X:=sent%, the date/time variables will reflect the original messages date/time.

Example for a longstring:

TIP: Result Sunday, 20.12.2011 16:24 +0100

Example of a shortstring:

TIP: Result Sunday, 20.12.2011 08:54:21

The following variables can be used in both variants:

String Manipulation (Premium Function)

New feature in SmartTemplates 3.12 - clipboard support

The clipboard can now be used by other functions (such as %header.set%) to transfer information to other headers or insert elsewhere in the template.

Note: the new %matchTextFromBody% and %matchTextFromSubject% functions use regular expressions - these are powerful keys for finding text patterns. The first parameter must be the regular expression within double quotes. The second parameter is a number which denotes the "match group". Match groups are usually designated with round parentheses (). Use 0 to match the complete expression, 1 for the first group etc.

To learn about regular expressions, please visit: www.regular-expressions.info. For testing your patterns, I recommend this online tester: regex101.com

Quote Manipulation (Pro Function)

Mail Header Manipulation (Premium Functions)

The following functions can be used to modify header fields such as the "To:" line of the email so that the Email is autopmatically sent to a different recipient. They are included in SmartTemplates Pro for unlimited use. Read up on the full functionality on the premium features page.

Parameters
Examples

Setting Priority

%header.set(priority,Priority)% = Change priority of Email. See also [Bug 26689]

Examples:

%header.set(priority,highest)%
%header.set(priority,high)%
%header.set(priority,normal)%
%header.set(priority,low)%
%header.set(priority,lowest)%

Inserting HTML files and Images

The %file()% and %style()% functions can be used for inserting images or HTML / text files which can even contain more SmartTemplates variables. They are included in SmartTemplates Pro for unlimited use. Read up on the full functionality on the premium features page.

Deferred Variables - Fields in New Emails

These are a subset of standard SmartTemplates variables, which perform in a specidal way when used in a "Write" situation: In this, certain information which is readily available when replying or following up / forwarding, is simply not present when opening the Email editor.

Note for templates

ATTENTION: Templates which use <br> tags should be used with "Replace new-line with <br>" option deactivated
and Templates without the <br> Tags included should be used WITH the option "Replace new-line with <br>" activated!

Note for HTML templates

ATTENTION: Please use only UTF-8 (Unicode) charset inside HTML templates!
A UTF-8 encoding table can be found here.