The function setvar() writes any value to be specified into a variable to be defined.
Structure of the command
setvar('var','value');
Return value
positive |
if the variable is created correctly and/or if its value has been correctly applied |
negative |
if the variable cannot be created (see warning undervar) |
Parameters
var
Name of the variable in which the value of 'value’ is to be stored. The name of the variable must be unique.
|
The name of the variable var must not start with a number. Otherwise, the variable will not be saved |
value
Content to be output when the variable 'var’ is queried.
Example 1
The value of the attribute "Name" is to be read from an LDAP directory. This is to be stored in the variable "name_from_ldap".
The statement looks like this:
Line |
Code |
|---|---|
01 |
if (rmatchsplit('@customer1\.com')) { |
02 |
setvar('customer','c1'); |
03 |
} |
04 |
if (rmatchsplit('@customer2\.com')) { |
05 |
setvar('customer','c2'); |
06 |
} |
Explanation
In this example, the email is checked for the presence of the expression @customer1.com in the envelope recipients (line 01). For those recipients whose email address contains the expression, the variable $customer with the content c1 is set.

