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!
SmartTemplates :: Variable Definitions
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
- - 0.9.3
%ownname%0.9.4 -%identity(name)%
- - 0.9.3
%ownmail%0.9.4 -%identity(mail)%
- - 0.9.3
%sig%0.9.4 -%sig(html)%
%sig(text)%
settings for delimiter (--) included in our global settings tab - - 0.9.3
%sig2%0.9.4 -%sig(html)%
%sig(text)%
Identity
%identity%
= Name + Email of the current selected identity%identity(name)%
= Name of the current selected identity%identity(name,link)%
= Name of the current selected identity as mailto link%identity(mail)%
= Email address of the current selected identity%identity(mail,link)%
= Email address of the current selected identity as mailto link%identity(addressbook,fieldId)%
= Use the 'addressbook' keyword to retrieve additional identity information from address book.
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
%date%
= Date / Time (same as original 'Mailheader')%sig%
= Signature from account settings%cursor%
= Sets the cursor position.%identity(name)%
= Your name (also%ownname%
)%identity(mail)%
= Your email (also%ownmail%
)%recipient%
= Final Recipient's name / mail address. what exactly is shown depends on the advanced setting "Default address format"%recipient(mail)%
= Recipient's email address (Text only)%recipient(firstname)%
= Recipient's First name%mailto(body)%
= use this to insert the body portion of a mailto link.%attach()%
Attaches a file to the emails.%spellcheck(language)%
= Sets the spell-checking language. Example values: (en, de, es, ru) - note that the dictionary must be installed.
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.
%to%
= Recipient's name (default)%to(firstname)%
= Recipient's first name%to(firstname,link)%
= Recipient's first name as mailto link%to(name)%
= Recipient's name%to(name,link)%
= Recipient's name as mailto link%to(mail)%
= Recipient's email address (Text only)%to(mail,link)%
= Recipient's email address as mailto link
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.
%from%
= Sender's name (default)%from(firstname)%
= Sender's firstname%from(firstname,link)%
= Sender's firstname as mailto link%from(name)%
= Sender's name%from(name,link)%
= Sender's name as mailto link%from(mail)%
= Sender's email address (Text only)%from(mail,link)%
= Sender's email address as mailto link%from(mail,toclipboard)%
= transfer sender's address to clipboard.
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.
%cc%
= Recipient's name (Default)%cc(firstname)%
= Recipient's first name%cc(firstname,link)%
= Sender's first name as mailto link%cc(name)%
= Recipient's name%cc(name,link)%
= Sender's name as mailto link%cc(mail)%
= Sender's email address (Text only)%cc(mail,link)%
= Sender's email address as mailto link
Address Book Fields
Contact
|
Private
|
Work
|
Other
|
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 [[...]]:
%to%
%to(firstname)%
%to(mail)%
%to(any_AB_field)%
%cc%
%cc(firstname)%
%cc(mail)%
%cc(any_AB_field)%
%to(firstname,link)%
%to(name,link)%
%to(mail,link)%
%cc(name,link)%
%cc(mail,link)%
%cc(firstname,link)%
%identity(addressbook,name)%
%identity(addressbook,any_AB_field)%
Subject
%subject%
= subject of current replied / forwarded email (same as original message header)%subject(2)%
subject of current replied / forwarded email (same as message editor "compose window")
Special Headers
%Message-ID%
= Message ID%Newsgroups%
= Newsgroups%X-Mailer%
= X-Mailer%...%
= Any Header-line
Signature (read from Account Settings)
By Default you can place the Signature by Account Settings in Thunderbird.
and remove the Signature delimiters '--' by our Global settings Tab.
But with follow variables you can override this positioning and use the variable with or without the delimiters.
%sig(html)%
= Signature HTML based%sig(text)%
= Signature Text based%sig(none)%
= To remove the signature completely, overriding account settings
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%
%datelocal%
= Date / Time (locale format)%dateshort%
= Date / Time short (e.g. 01.01.2000 1:23:45)%date_tz%
= Timezone aberration (+0100, +0200, ... )%tz_name%
= GMT, PST, EST, ...%tz_name(1)%
= Greenwich Mean Time, Pacific Standard Time, Eastern Standard Time, ...
Variables for customized 'Date format'
TIP: Can be combined with %X:=sent%
%A%
= Day of Week (Friday)%a%
= Day of Week (Fri.)%B%
= Month (January)%b%
= Month (Jan.)%d%
= Day of Month (01 to 31) - with leading zero%e%
= Day of Month (1 to 31)%m%
= Month (01 to 12) - with leading zero%n%
= Month (1 to 12)%Y%
= Year (1970)%y%
= Year (70)%M%
= Minute (00 to 59)%S%
= Second (00 to 59)%H%
= Hour, 24-Hour Format (00 to 23) - with leading zero%k%
= Hour, 24-Hour Format (0 to 23)%I%
= Hour, 12-Hour Format (01 to 12) - with leading zero%l%
= Hour, 12-Hour Format (1 to 12)%p%
= AM / PM%p(1)%
= a.m.%p(2)%
= A.M.%p(3)%
= AM%dateformat(parameters string)%
= Function for inserting current time (clickable field).Most time the "one letter" variables from above can be used in the parameter string by omitting %. You can also use delimiters such as "," "/" "-" "." ":" etc and spaces. See also: [Bug 26588].
Examples:
variable results %dateformat(B/d/Y l:M:S p)%
October/24/2019 9:41:04 PM %dateformat(d/n/Y k:M:S)%
24/10/2019 21:41:13 %dateformat("A, e/n/Y H:M",toclipboard)%
(new in v3.12) Copy time to clipboard. use in a reply mail to retrieve datestamp of original mail. %dateformat("A, e/n/Y H:M",current,toclipboard)%
(new in v3.12) Copy current time to clipboard
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)
%cwIso(0)%
= First Day of Week is Sunday%cwIso(1)%
= First Day of Week is Monday%cwIso(2)%
= First Day of Week is Tuesday%cwIso(3)%
= First Day of Week is Wednesday%cwIso(4)%
= First Day of Week is Thursday%cwIso(5)%
= First Day of Week is Friday%cwIso(6)%
= First Day of Week is Saturday
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.
%X:=sent%
Example for a longstring:
%X:=sent% %A%, %d%.%m%.%Y% %H%:%M% %date_tz%
TIP: Result Sunday, 20.12.2011 16:24 +0100
Example of a shortstring:
%X:=sent% %datelocal%
TIP: Result Sunday, 20.12.2011 08:54:21
The following variables can be used in both variants:
%datelocal%
= Date / Time (Local Format)%dateshort%
= Date / Time short (e.g. 01.01.2000 1:23:45)%date_tz%
= Timezone aberration (+0100, +0200, ... )%tz_name%
= GMT, PST, EST, ...%tz_name(1)%
= Greenwich Mean Time, Pacific Standard Time, Eastern Standard Time, ...
String Manipulation (Pro Function)
%deleteText("text")%
= Remove some text from the Quote Header, such as deleteText("via Paypal")- "John via Paypal wrote" => "John wrote"%replaceText("find","replace")%
= Replace some text with something else (similar to deleteText).%matchTextFromBody("Regular Expression",MatchGroup)%
= Finds a pattern in quoted Email and insert at function location.
E.g.%matchTextFromBody("Delivery from ([-'a-zA-Z\u00C0-\u024F]*\s[-'a-zA-Z\u00C0-\u024F]*)",1)%
will retrieve 'John Doe' from the line 'Delivery from John Doe' - (included unicode characters for diacritics)%matchTextFromSubject("Regular Expression",MatchGroup)%
= Finds a pattern in subject and insert at function location.
E.g.%matchTextFromSubject("\b[a-zA-Z0-9._+-]+@[a-z0-9.-]+\.[a-z]{2,4}\b",0)%
will retrieve an Email address from the Subject line
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.
%replaceText(regularExpression,clipboard)%
- (new in v3.12) overwrite placeholder text in template from clipboard.%matchTextFromSubject("Regular Expression",MatchGroup,toclipboard)%
= Extract text from the subject and copy to the clipboard.%matchTextFromBody("Please reply until (.*)",1,toclipboard)%
= Extract text from the original mail and copy itr to the clipboard. In this example you can extract a date, and maybe transfer it to the subject line afterwards using%header.append(subject,clipboard)%
. You can also use%dateformat("A, e/n/Y H:M",toclipboard)%
to copy the time stamp of the original mail
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)
-
[issue 61] Variable for quoted text.
%quotePlaceholder(quoteLevel)%
This moves the quoted part into the template text itself. The quote header section from account templates will be moved to the top of this quote. The optional numerical parameter quoteLevel is the maximum citation level to exclude older quote parts from the conversation. - [issue 31]
From SmartTemplates 2.8: Variables to remove text / tags from quoted parts
and save space. From 3.11 onwards this also supports changing texts of inline forwarded mail.
%deleteQuotedText("searchText",quoteLevel)%
Deletes quoted Text
%replaceQuotedText("searchText","replacementHTML",quoteLevel)%
Replaces quoted text
%deleteQuotedTags("selector",quoteLevel,minSize)%
Deletes tags from the quote
%replaceQuotedTags("selector","replacementHTML",quoteLevel,minSize)%
Deletes tags from the quote
searchText - must be in double quotes - the searchText argument must be a regular expression. Note that whitespace can be best represented as \s because it can also contain line breaks. Commas and double quote characters cannot be used.
replacementHTML - must be in double quotes - text or a html tag which will be inserted in page. quoteLevel - optional, (number) which minimal quote level to start from
selector - what you would use to address the tag in css. simplest case "img", or "p" but attribute selectors can be added as long as double quotes can be avoided.
minSize - (optional, numeric) - number of kByte, minimum size for removing the tag. This way you can keep smaller images like icons / emojis while discarding large images.A note on quoteLevel, for images I would recommend 2 if you want to remove images to retain some context in your replies. This will dramatically decrease email sizes in long threads which contain a lot of images (e.g. screenshots).
To use the function (v3.11 and later) during forwarding, use the parameter quoteLevel=0 to remove text from the original mail text.
-
%suppressQuoteHeaders%
- use this command to suppress all quote headers - the ones inserted by Thunderbird automatically (usally along the lines of "on 12/03/2020 John Doe wrote:") and also any of the replacement ones configured in SmartTemplates account settings.
Mail Header Manipulation (Pro 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 Pro features page.
-
%header.set(subject,"text",textTransform)%
= Replace subject with the text -
%header.prefix(subject,"text",textTransform)%
= Prefix subject with the text -
%header.append(subject,"text",textTransform)%
= Append text to subject -
%header.delete(subject,pattern)%
Remove matching regular expression from text. -
%header.deleteFromSubject(pattern)%
(from v2.8.1) Remove matching pattern from subject. -
%header.set(to,clipboard)%
- (new in v3.12) set the final recipient from the clipboard -
Special pattern matching functions:
%header.set.matchFromSubject(pattern,matchgroup,altText)%
%header.prefix.matchFromSubject(...)%
%header.append.matchFromSubject(...)%
%header.set.matchFromBody(pattern,matchgroup,altText)%
%header.prefix.matchFromBody(...)%
%header.append.matchFromBody(...)%
Parameters
- pattern = a regular expression, wrapped in double quotes, e.g. "\b(Dog\S*)" for words starting with "Dog"
- matchgroup = when using groups in a pattern (these are contained in round parentheses) this is denotes the number of the group. 0 is placeholder for the complete match.
- altText = string, optional parameter; this alternative text will be used when no match can be found
Examples
-
%header.set(to,"abc@de.com")%
= Replace recipient with email address -
%header.append(to,"abc@de.com")%
= Add email to recipient list -
%header.delete(subject,"([\[\(] *)?(Re|Fwd|AW?)*([-:;)\]][ :;\])-]*)|\]+")%
= Remove common quote prefixes from subject line.
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
%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 Pro 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.
- NEW
When writing new mails, headers such as to, from are not available - therefore these functions had to be written from scratch.
[Bug 24993] Supports using the following fields when composing a *new* Email:
%subject%
%from%
%to%
%cc%
%bcc%
%date%
%dateformat()%
New function for building date strings for current date, see here.
Note, to insert the real recipient in a forwarded email, you can now use the fwd argument: e.g.
%to(firstname,fwd)%
The variables are shown as colored placeholder blocks and can be updated with a simple mouse-click:
This will pull in the correct information when available and can be clicked multiple times.A new button for a final clean up - for "tidying up ALL variables" can also be added to the Composer toolbar:
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.