forwarding emails using sieve

Stephan Bosch
Wed, 01 Jun 2016 14:58:31 -0000

Op 1-6-2016 om 3:39 schreef Thorsten von Eicken:
> I know this is a tad tangential to dovecot, but maybe someone has some
> pointers for me. I'm trying to forward emails using the sieve
> filtering and redirect doesn't do it because it doesn't wrap the
> message in a new email, instead, it seems to just change the envelope
> From (and To). This causes the outbound relay to reject the message
> for security/spam reasons (forged From).

Forwarding like that is currently not possible with the Sieve language.
The "enclose" extension seems to come close, but it explicitly has no
effect on redirected messages, which I find rather strange.

> It looks like the dovecot sieve implementation doesn't let me change
> the From header in the sieve script. Is there a way to accomplish what
> I'm looking for?

Changing the "From" header field can be done using the
"editheader"
extension (https://tools.ietf.org/html/rfc5293).

require "editheader";

deleteheader "From";
addheader "From" "User <user at example.com>";

Note that this extension is not enabled by default and thus requires
explicit configuration.

Regards,

Stephan.