I want to write a spam rule that allowlists a given domain if it is present in any header address. The expressions docs left me with many more questions.
Problem 1: Global variables is unclear about variable types.
- How are header variables like
cc handled when they contain multiple values? Is this a single long string (the entire header value) or does Stalwart split these into an array of strings?
Problem 2: Email functions doesn't explain if or how text functions handle arrays.
- The
ends_with docs (and all other text functions) say that they accept a string, not an array of strings.
- Given this example:
ends_with(cc.domain, 'example.com') when there are multiple cc'ed addresses:
- Is
cc.domain an array or a string?
- If it's an array, is this even legal?
- If it's legal, is
ends_with evaluated once per array element?
- If so, is the expression true when all domains match (AND) , or when any match (OR)?
- If this is OR, then how can I express an AND across all haystack elements?
- If the "haystack" can be an array, then can the "needle" be too?
- Example:
ends_with(cc.domain, ['foo.com', 'bar.com'])
- Is this like Sieve where the expression is true if any haystack matches any needle?
- Can the haystack be an array of arrays?
- Example:
ends_with([from.domain, to.domain. cc.domain], ['foo.com', 'bar.com'])
I want to write a spam rule that allowlists a given domain if it is present in any header address. The expressions docs left me with many more questions.
Problem 1: Global variables is unclear about variable types.
cchandled when they contain multiple values? Is this a single long string (the entire header value) or does Stalwart split these into an array of strings?Problem 2: Email functions doesn't explain if or how text functions handle arrays.
ends_withdocs (and all other text functions) say that they accept a string, not an array of strings.ends_with(cc.domain, 'example.com')when there are multiple cc'ed addresses:cc.domainan array or a string?ends_withevaluated once per array element?ends_with(cc.domain, ['foo.com', 'bar.com'])ends_with([from.domain, to.domain. cc.domain], ['foo.com', 'bar.com'])