When is a User Sieve Script activated? Before or After Spam-Filtering?

Your question

I have an account that has a User Sieve script assigned that matches “*” and forwards all mail received to a different mail server. I’m trying to determine if this Sieve script is activated and run before or after the mail is processed by the Spam-Filter process?

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

Order is: SMTP DATA (spam filter runs here, can reject) → message
accepted to the queue → per-recipient delivery → per-user sieve.
So a “forward everything” user script does run on messages that the
spam filter scored but didn’t reject (e.g. flagged-as-spam but
accepted).

If you want to skip spam in the script, guard the redirect:

require ["spamtest", "comparator-i;ascii-numeric"];
if not spamtest :value "ge" :comparator "i;ascii-numeric" "5" {
    redirect "[email protected]";
}

spamtest returns the numeric spam score at delivery (the verdict
is attached before the user script runs). Alternatively raise the
spam-filter rejection threshold so accepted-spam never reaches the
script in the first place.

Does this mean, the SpamStatus and SpamScore headers are visible to Sieve scripts a user defines (example in Roundcube)?

The spam score and tags are visible as headers but not the final result. To access the final result you need to use the spamtest function.

Thank you. This is helpful to understand.