global::obj
vSL objects declaration functions. vSL objects utility methods. vSL objects Eq method between each other and other types.
fn
ip4
fn ip4(ip: String) -> VSLObject
Build an ip4 address. (a.b.c.d)
get
domain
fn get domain(addr: VSLObject) -> VSLObject
Get the domain of an email address.
address
- the address to extract the domain from.
All of them.
#{
mail: [
// You can also use the `get_domain(ctx::mail_from())` syntax.
action "display sender's domain" || {
log("info", `received a message from domain ${ctx::mail_from().domain}.`);
}
],
}
op
==
op ==(this: SharedObject, s: String) -> bool
op ==(this: SharedObject, other: SharedObject) -> bool
op ==(this: String, other: SharedObject) -> bool
Operator `==` for `SharedObject` and `&str`
get
domains
fn get domains(container: Array) -> Array
Get all domains of the recipient list.
rcpt_list
- the recipient list.
mail
and onwards.
#{
mail: [
action "display recipients domains" || {
print("list of recipients domains:");
// You can also use the `get_domains(ctx::rcpt_list())` syntax.
for domain in ctx::rcpt_list().domains {
print(`- ${domain}`);
}
}
],
}
fn
to_string
fn to_string(this: VSLObject) -> String
Convert a `SharedObject` to a `String`
fn
to_debug
fn to_debug(this: VSLObject) -> String
Convert a `SharedObject` to a debug string
fn
regex
fn regex(regex: String) -> VSLObject
a regex (^[a-z0-9.]+@foo.com$)
fn
contains
fn contains(this: SharedObject, other: SharedObject) -> bool
fn contains(this: SharedObject, s: String) -> bool
fn contains(map: Map, object: SharedObject) -> bool
Operator `contains`
fn
identifier
fn identifier(identifier: String) -> VSLObject
a user identifier.
fn
code
fn code(code: int, text: String) -> VSLObject
fn code(code: int, enhanced: String, text: String) -> VSLObject
A SMTP code with the code and message as parameter.
let code = code(250, "Ok");
let enhanced = code(451, "5.7.3", "STARTTLS is required to send mail");
op
==
op ==(this: SharedObject, s: String) -> bool
op ==(this: SharedObject, other: SharedObject) -> bool
op ==(this: String, other: SharedObject) -> bool
Operator `==` for `SharedObject` and `&str`
fn
fqdn
fn fqdn(domain: String) -> VSLObject
a valid fully qualified domain name (foo.com)
get
domain
fn get domain(addr: VSLObject) -> VSLObject
Get the domain of an email address.
address
- the address to extract the domain from.
All of them.
#{
mail: [
// You can also use the `get_domain(ctx::mail_from())` syntax.
action "display sender's domain" || {
log("info", `received a message from domain ${ctx::mail_from().domain}.`);
}
],
}
fn
code
fn code(code: int, text: String) -> VSLObject
fn code(code: int, enhanced: String, text: String) -> VSLObject
A SMTP code with the code and message as parameter.
let code = code(250, "Ok");
let enhanced = code(451, "5.7.3", "STARTTLS is required to send mail");
fn
ip4
fn ip4(ip: String) -> VSLObject
Build an ip4 address. (a.b.c.d)
fn
rg6
fn rg6(range: String) -> VSLObject
an ip v6 range. (x:x:x:x:x:x:x:x/range)
get
domains
fn get domains(container: Array) -> Array
Get all domains of the recipient list.
rcpt_list
- the recipient list.
mail
and onwards.
#{
mail: [
action "display recipients domains" || {
print("list of recipients domains:");
// You can also use the `get_domains(ctx::rcpt_list())` syntax.
for domain in ctx::rcpt_list().domains {
print(`- ${domain}`);
}
}
],
}
fn
to_debug
fn to_debug(this: VSLObject) -> String
Convert a `SharedObject` to a debug string
fn
to_string
fn to_string(this: VSLObject) -> String
Convert a `SharedObject` to a `String`