Issue Description
Such script used in RCPT_TO stage fails, with “5.1.2 Mailbox does not exist” while everything looks fine in the notified message.
require ["variables", "envelope", "regex", "editheader", "enotify"];
if allof( envelope :localpart :contains "to" ".",
envelope :regex "to" "fwd\.([^.]+)@(.+)$")
{
set "envelope.to" "user+${1}@${2}";
notify :message "Testing ${envelope.to}/initially ${0}" :from "user@domain" "mailto:[email protected]";
addheader "X-Alias" "${1}";
stop;
}
I’m trying address rewriting in Sieve in order to set an custom header storing the initial “to” address since the direct rewriting rule fails in user script (“envelope.to” doesn’t contain the subaddressing part in user script’s sieve).
Yet, the output envelope.to from the sieve script here is correct in the notified message but Stalwart still reject the mail with “Mailbox does not exist” error.
Tried the rewriting without the subaddressing (set "envelope.to" "user@${2}";) and it still is rejected.
Expected Behavior
Stalwart shouldn’t mess with envelope.to subaddressing (the part after the “+” in user+something@domain) when it reaches the user script. Because it doesn’t work, Stalwart should accept address rewriting in a system sieve script and later check the resulting envelope.to address that the script generated, not the initial address.
Actual Behavior
The mail is rejected with 5.1.2 Mailbox does not exist.
Reproduction Steps
Set a system script with the content above (and adapt the domain and user account to your system and the notified email for debugging). Send a mail to fwd.something@yourdomain.
Observe Stalwart rejecting the mail instead of accepting it.
Stalwart Version
v0.16.x
Installation Method
Binary (Linux)
Database Backend
PostgreSQL
Blob Storage
Filesystem
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