105 lines
2.1 KiB
TOML
105 lines
2.1 KiB
TOML
|
|
[envelope]
|
|
rcpt-domain = "foo.example.org"
|
|
rcpt = "user@foo.example.org"
|
|
sender-domain = "foo.net"
|
|
sender = "bill@foo.net"
|
|
local-ip = "192.168.9.3"
|
|
remote-ip = "A:B:C::D:E"
|
|
mx = "mx.somedomain.com"
|
|
authenticated-as = "john@foobar.org"
|
|
priority = -4
|
|
listener = 123
|
|
helo-domain = "hi-domain.net"
|
|
|
|
[eval."eq"]
|
|
test = [
|
|
{if = "sender", eq = "bill@foo.net", then = "${0}"},
|
|
{else = false}
|
|
]
|
|
expect = "bill@foo.net"
|
|
|
|
[eval."starts-with"]
|
|
test = [
|
|
{if = "rcpt-domain", starts-with = "foo", then = "${0}${{0}}"},
|
|
{else = false}
|
|
]
|
|
expect = "foo.example.org${0}"
|
|
|
|
[eval."regex"]
|
|
test = [
|
|
{if = "rcpt", matches = "^([^.]+)@([^.]+)\.(.+)$", then = "${1}+${2}@${3}"},
|
|
{else = false}
|
|
]
|
|
expect = "user+foo@example.org"
|
|
|
|
[eval."regex-full"]
|
|
test = [
|
|
{if = "rcpt", matches = "^([^.]+)@([^.]+)\.(.+)$", then = "${0}"},
|
|
{else = false}
|
|
]
|
|
expect = "user@foo.example.org"
|
|
|
|
[eval."envelope-match"]
|
|
test = [
|
|
{if = "authenticated-as", matches = "^([^.]+)@(.+)$", then = "rcpt ${rcpt} listener ${listener} ip ${local-ip} priority ${priority}"},
|
|
{else = false}
|
|
]
|
|
expect = "rcpt user@foo.example.org listener 123 ip 192.168.9.3 priority -4"
|
|
|
|
[eval."static-match"]
|
|
test = [
|
|
{if = "authenticated-as", matches = "^([^.]+)@(.+)$", then = "hello world"},
|
|
{else = false}
|
|
]
|
|
expect = "hello world"
|
|
|
|
[eval."no-match"]
|
|
test = [
|
|
{if = "authenticated-as", matches = "^([^.]+)@([^.]+)\.(.+)$org", then = "${1}+${2}@${3}"},
|
|
{else = false}
|
|
]
|
|
expect = false
|
|
|
|
[store."list_mx/domains"]
|
|
type = "memory"
|
|
format = "list"
|
|
values = ["mx"]
|
|
|
|
[store."list_foo/domains"]
|
|
type = "memory"
|
|
format = "list"
|
|
values = ["foo"]
|
|
|
|
[store."list_123/domains"]
|
|
type = "memory"
|
|
format = "list"
|
|
values = ["123"]
|
|
|
|
[maybe-eval."dyn_mx"]
|
|
test = [
|
|
{if = "mx", matches = "([^.]+)\.(.+)$", then = "list_${1}/domains"},
|
|
{else = false}
|
|
]
|
|
expect = "mx"
|
|
|
|
[maybe-eval."dyn_foo"]
|
|
test = [
|
|
{if = "sender-domain", matches = "([^.]+)\.(.+)$", then = "list_${1}/domains"},
|
|
{else = false}
|
|
]
|
|
expect = "foo"
|
|
|
|
[maybe-eval."static_mx"]
|
|
test = "list_mx/domains"
|
|
expect = "mx"
|
|
|
|
[maybe-eval."static_foo"]
|
|
test = "list_foo/domains"
|
|
expect = "foo"
|
|
|
|
[maybe-eval."dyn_123"]
|
|
test = "list_${listener}/domains"
|
|
expect = "123"
|
|
|