is_true

March 26, 2020 Contributors

Name

is_true — test if a value is "true"

Synopsis

is_true { $variable }

is_true { $variable[0] }

is_true { $variable["key"] }

Description

The is_true is intended to provide a simple logical test on the value of a variable.

$result = ds_fetch "mydatabase"
  "select allow from senders where sender = ?"
      ["%{mailfrom_localpart}@%{mailfrom_domain}"];
if is_true $result {
  ec_log "Allowed mail from %{mailfrom_localpart}@%{mailfrom_domain}";
} else {
  ec_action 550 "You're not allowed";
}