Introduction
This page details the workings of variables in Scythe expressions.
Basics
Variables are identified by a preceeding $ , e.g. $name . Names can consist of A-Z, 0-9, dash and underscore. There is no requirement to start the name with a letter. Names are case sensitive.
Values
Variables are not limited to holding values in the traditional sense, they actually hold expressions. So the following are all valid:
- $count = 23
- $message = "hello"
- $friends = ["rod", "jane", "freddy"]
- $whitelist = ($from-name contains $friends)
Delayed evaluation
Unlike in traditional programming languages, variables only take a value at the time they are used. Consider the following pseudo-code:
$b = $a
$a = 12
print $b
The output from this code is 12, not 10. $b has been set to hold whatever the value of $a is. At the time we evaluated $b , $a holds the value 12 hence so does $b .
Common variables
Common variables are defined by Scythe when considering a mail message. You should avoid defining variables with these names.
Addresses
Mail headers that hold email addresses form entries in 4 variables whose names that the form $aaa-bbb . aaa refers to the mail header and bbb is a key for a component of the address. Consider the following header:
This will cause the creation of the following values:
- $to-address = "duncan@brown.cow"
- $to-account = "duncan"
- $to-host = "brown.cow"
- $to-name = "Duncan Martin"
The values are all lists so for a particular mail $to-address , for example, may hold multiple addresses.
The possible values of aaa are:
- to - Declared primary recipients of the message
- from - Sender of the message
- cc - Recipients of carbon-copies of the message
- envto - Address the message was actually delivered to
Other
- $subject holds the subject of the message
- $folder holds the folder of the message
- $number holds the MH number of the message
