Sieve behaves unexpected

Issue Description

When using sieve scripts, variables are expected to be valid inside the script. The following script is being used:
require “copy”;
require “mailbox”;
require [“fileinto”,“imap4flags”,“enotify”,“variables”];

set “addresses” “:test1.com:test2.com:test3.com:test4.com:test5.com:”;

if address :domain :matches “To” “*” { set “domain_to” “${1}”; }

    fileinto "testdomainto/${domain_to}";

    if string :contains "${addresses}" [":${domain_to}:" ]
    {
            if string :matches "${domain_to}" "*.*" { set "folder" "${1}"; fileinto "Folder-set/${folder}";}
                            
            fileinto "Result/${folder}";
            stop;           
    }

with the email of:
From: [email protected]
To: [email protected]
Subject: Hello from Sievepad
Date: Mon, 14 Sep 2026 10:00:00 +0000
Message-ID: [email protected]
Content-Type: text/plain; charset=“utf-8”

Hello! This is a test message.

Expected Behavior

  1. mail will be filed into “testdomainto/test1.com”
  2. mail will be filed into “Folder-set/test1”
  3. mail will be filed into “Result/test1”

Actual Behavior

  1. mail will be filed into “testdomainto/”

Reproduction Steps

  1. create the user script as shown above
  2. run the sievpad.com testing environment

Stalwart Version

v0.16.x

Installation Method

Binary (Linux)

Database Backend

MySQL

Blob Storage

S3-compatible

Search Engine

MySQL

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

This isn’t covered in the current docs. A community member or staff member will follow up.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Fixed in v1.0.0 (expected for end of this month or early November).