Your question
I want to apply a sieve script to my outgoing emails (changing ‘FROM: [email protected]’ to 'FROM: [email protected]). When I send emails through an email client that connects to Stalwart via JMAP, sieve script isn’t apply. I believe sieve scripts only apply to emails from clients connected via SMTP. Is there any spot in Stalwart where I can apply a sieve script to JMAP emails?
Stalwart 0.16.11 (Docker)
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
User Sieve scripts run only on inbound delivery, so they never touch mail you submit, whether via JMAP or SMTP, which is why yours isn’t applying. But JMAP submission isn’t exempt from the MTA: it runs through the same SMTP data/queue path, and that path executes the server-level (trusted) Sieve script. So the place to rewrite From on outgoing mail is a system-level DATA-stage script (or the MTA header-rewrite configuration), applied at submission, not a user script.
One caution: rewriting the From address on outbound mail can break DKIM alignment, SPF and DMARC for the new address, so make sure whatever you rewrite it to is a domain this server is authorized to send and sign for.