Skip to content

Document expression arrays and text functions #75

@mwinters0

Description

@mwinters0

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'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions