Is it possible to create a global filter, that would work on the whole server, and could ignore periods in e-mail address? Just like Gmail is doing for @gmail.com accounts?

I need to solve the issue where I don’t use periods in e-mail like: for example: jsmith@contoso.com but people are sending messages for j.smith@contoso.com - I want to receive all messages in jsmith@contoso.com account even if someone is sending the message to j.s.m.i.t.h.@contoso.com. I don’t want to create an alias for every account.

There’s a script on stalw.art Icon Envelope | Stalwart Labs

which addresses this issue:

require ["variables", "envelope", "regex"];
if allof( envelope :localpart :contains "to" ".",
envelope :regex "to" "(.+)@(.+)$") {
set :replace "." "" "to" "${1}";
set "envelope.to" "${to}@${2}";
}

However, mailcow cannot parse it. Is there any other solution for what I’m trying to do?
Thanks!

I used sievec to validate your script and got an error

Error: Unknown or incompatible type >>string/<< at >>:replace "." "" "to" "${1}"; set "envelope.to" "$<<

so set :replace "." "" "to" "${1}"; seam to be wrong

ChatGPT think this about your script

Errors in the Script

    Incorrect set Command Usage:
        The set command in Sieve requires a variable name to be set directly. The current script attempts to set "envelope.to," which is not directly supported as a variable in the Sieve scripting language. Instead, variables should be user-defined or predefined by the Sieve environment.

    Misuse of :replace Modifier:
        The :replace modifier is not a valid syntax in the context of the set command in Sieve. Instead, use the regex extension to perform replacements.

    Improper Handling of Regular Expressions and Captured Variables:
        Captured groups in the regex match should be accessed correctly. When using regular expressions in Sieve, you need to store the matched components explicitly into variables.

Have something to say?

Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

No one is typing