Scripting Capabilites

Scripts may be provided in the text of a template and are enclosed within <vbscript>...</vbscript> for VBScript and <et>... </et> for Tcl scripts. They are evaluated before the new message is created, in the order that they are entered. You may add as many scripts as are necessary. Scripts will not appear within the final message. Inline scripts may be used to create new template elements, change message properties, perform actions on the mailbox, etc.

Here is an example of a simple script inside a template:

Hi guys,
Today is &day_of_the_week; and I work from home!

set day [clock format [clock seconds] format %A]
et add day_of_the_week $day

If this template was evaluated on a Tuesday, the result message would look like:

Hi guys,
Today is Tuesday and I work from home!

Automatic Templates

Email Templates can work with Microsoft Outlook Rules Wizard to create templates that are activated automatically and sent to your Outbox for confirmation when certain conditions are met. For instance, you can automatically forward a memo from a supervisor to your subordinates in a personalized manner. To do this, set the conditions to be met with Microsoft Outlook Rules Wizard. Setting the action to custom action will allow you to activate a selected template. This is always done through templates rather than extensions, but extensions may be called by the template. In fact, the template does not necessarily need to be an email message. The template may be used to activate other templates under certain conditions, access a file, or even run a program.  (Note: Custom actions are not supported in Outlook XP).

Address Finder

To have a personalized reply ready and in your Outbox for confirmation, you'll want to tell Rules Wizard the conditions on which to activate the template, and which template to activate. For instance, let's say you want to take each incoming message from a particular source and parse the message body for any email addresses you might find and forward the contents to those addresses. Your code might look something like this:

set text [et message body]
set text [split $text " \n\r,()\t:;\"*<>+^&%'"]
foreach word $text {
if [string match *?@?* $word] {
et set recipient [string trim $word ".\]\[\}\{()"]
et set subject "Memo."

I've just recieved a memo from &sender_name;. I think you might want to take a look at it.


Download this template!

Don't forget to set it up with Rules Wizard. Set the conditions for which the template will be activated. Then select Perform custom action. You will be able to select the template to activate from your new message, reply, and forward template folders.

Working with external applications

With scripting, it is relatively easy to manage and work with files from the file tree. This allows you to easily pass information between templates or incoming email messages and local files.

Files as Attachments

Normally you can send the attachments that came with the message you are applying the template to with the &attachments; element. If you would like to add your own attachment, however, the process is almost as simple:

set filename [et choose file]
et set attachment $filename

Here is the file as an attachment to the message ...

Download this template!

Note that this will not interfere with the &attachments; element in the message body. You can send both if you prefer.

Files appended as text

Similarly, you can append a file as text to the outgoing message. In this example, you can select a file with the same procedure as before, but this time you can include the file's contents in the text.

set filename [et choose file]
set filename [open $filename r+]
seek $filename 0 start
set filetext [read $filename]
close $filename
et add filetext $filetext

Here is the file appended to the message as text...

Download this template!

Note that in this example, as well, you can still add the previous attachments with &attachments;.

Importing Contacts from a File

In this template, a local file containing names and email addresses separated by tabs is read by the template. The new names are added as contacts.

Download this template!

Download a sample contact file!

Redirecting Templates

Email templates also has a feature that allows you to redirect information from one template to another for further processing. You'll find the et redirect command useful for activating a template only under a certain set of conditions.


This example demonstrates how you can use Email templates to scan your email messages for keywords, and then perform a desired operation if found. The example looks for the keywords "subscribe" or "unsubscribe"

This example searches the subject line of a message for either of the keywords, "subscribe" or "unsubscribe". If either of the two are found, the template will add or remove the sender from your mailing list accordingly. The template then creates and sends a personalized confirmation email to that person.

This template can prove extremely useful if you receive email from visitors of your web page in which you know exactly what the subject line and desired action are going to be. (i.e. A subscribe or unsubscribe email)

Download this template to process the email!

If the message has subscribe in the subject, this reply will activate:

Download this template to confirm a subscriber!

If the message has unsubscribe in the subject, this reply will activate:

Download this template!