info.mailtraq.com > Management > Script Functions A-Z > If() If()Returns one of two given expressions based upon the result of the first expression. This is similar to the if...then...else construct found in most languages. Three expressions are given to the function. If the first expression evaluates to true the second expression is evaluated and returned, otherwise, if given, the third expression is evaluated and returned.
result := If( Boolean , true [ , false ] )
- Boolean
- An expression which evaluates to "TRUE" or "FALSE"
- true
- The expression evaluated if Boolean evaluates to "TRUE"
- false
- Optional; the expression evaluated if Boolean evaluates to "FALSE". If false is not given and if Boolean evaluates to "FALSE", no value is returned
- result
- The result of the evaluation of either true or false
//Example usage
If(UserOf(Header("To")) = "webmaster",
SetHeader("From", AddressOf("webmaster"),
SetHeader("From", AddressOf("postmaster")
) |