deleteheader in Sieve system script has no effect on User-Agent header

Issue Description

using Stalwart lastest release

Created a system Sieve script in WebUI (Settings > Sieve > System Scripts):

require [“editheader”];
deleteheader :index 1 “User-Agent”;
deleteheader :index 1 “X-Originating-IP”;

Bound it to DATA Stage (Settings > MTA > Session > DATA Stage > Run Script):
{“else”: “‘remove-privacy-headers’”}

editheader extension is enabled.

Result:

  • Log says: "Warning Sieve script not found "
  • Script is visible in WebUI list
  • User-Agent header remains in delivered message
  • Tried recreating with different name, same result
  • Tried :index 1, :matches “*”, unconditional deleteheader — none work

Looks like the script exists in WebUI but isn’t loaded at runtime. systemctl restart stalwart doesn’t make any difference. Either a cache/sync bug or the script reference format is wrong.

Expected Behavior

should apply script

Stalwart Version

v0.16.x

Installation Method

Built from source

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

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

I have enough context now. The docs confirm isActive must be true for the script to be picked up. Let me check for the “not found” warning source specifically tied to running scripts (not managesieve CRUD).

yes it happens even isactive is true

The key line is the “Sieve script not found” warning: the script isn’t running at all, which is why User-Agent survives. deleteheader does work on User-Agent in a system script (system scripts have no protected-header restrictions), so once the script actually executes it’ll strip it.

Two things to check. First, the name in the DATA-stage “Run Script” expression has to match the system script’s Name field exactly; if the expression evaluates to remove-privacy-headers, a system script named exactly that must exist and be active. Second, and this is the likely culprit, make sure the script compiles: if it has a compile error it shows in the UI but is never loaded at runtime, and you’ll see a “Failed to compile system Sieve script” line in the startup log. A common cause is smart or curly quotes getting pasted into require [“editheader”] or the deleteheader arguments instead of straight ASCII quotes. Fix those and it should load and run.