Sieve adding header content to a different header

Alex JOST jost+lists at dimejo.at
Wed Jul 24 17:09:29 EEST 2019


Am 23.07.2019 um 15:40 schrieb @lbutlr via dovecot:
> Given a message itht he headers:
> 
> Subject: This is the subject:
> X-Foo: bar
> 
> how would I do the following:
> 
>     1) Add the contents of X-Foo to subject
>        Subject: [bar] This is the subject
> 
>     2) replicate the X-Foo header into X-temp
>        X-temp: X-foo-bar

I haven't tested it but try something like this:

require ["fileinto", "editheader", "variables"];

if header :matches "X-Foo" "*" {
   set "foo" ": ${1}";
   addheader "X-temp" "X-foo-${foo}";

   if header :matches "Subject" "*"
     deleteheader "Subject";
     addheader "Subject" "[${foo}] ${1}";
   }
}

-- 
Alex JOST


More information about the dovecot mailing list