software/mail-server: fix headers of redirected mail
SnappyMail has a UI for making server-side rules (using Sieve) such as auto forwarding (these are internally called redirects). However a Sieve redirect can only target one address and SnappyMail's UI thus only allows one destination. To forward to multiple addresses one has to put multiple "redirect" actions.
Previously we patched SnappyMail so in addition to a "redirect" command it also added useful headers (such as X-Forwarded-To) and removed ones we didn't want (such as X-Bogosity or DKIM-Signature). But there was still the issue that if one created a rule with multiple redirects, in a single SnappyMail "script" (rule), then the addresses of targets would leak; recipients would know to whom else it had been forwarded.
This MR removes the SnappyMail patch (so a redirect in the UI emits a single Sieve redirect command) and instead adds a wrapper around the sendmail that Dovecot calls to perform redirects. This wrapper detects that the mail being sent is a redirect (since the X-Sieve-Redirected-From header is set) and performs the desired changes.
The wrapper is currently a Python script. If performance becomes an issue it could quite easily be replaced by a compiled program (C++, Rust maybe?).