[Dovecot] sieve vacation question

Stephan Bosch stephan at rename-it.nl
Mon Sep 9 11:26:53 EEST 2013


Op 6-9-2013 22:40, Andreas Schulze schreef:
> Hello Stephan,
>
> I love to use the vacation extension to build an echo service.
> I have not to worry about whether to answer or not if the sender is a list,
> postmaster, mailer-daemon or other crasy thing.
>
> But i like to echo the *complete headers* back.
> I did not found a solution with sieve yet. Is it really impossible?

Well, Sieve is certainly not meant for something like that. To echo the 
complete message back verbatim you could do the following:

require "envelope";
require "variables";
require "relational";

if envelope :matches "from" "*" {
     if string :count "gt" "${1}" "0" {
         redirect "${1}";
     }
}

Pigeonhole doesn't currently implement anything that could modify that 
message's body. Only the header can be modified using the editheader 
extension. That way you could swap from and to and modify the subject, 
e.g. as follows:

require "envelope";
require "variables";
require "relational";
require "editheader";

if envelope :matches "from" "*" {
     if string :count "gt" "${1}" "0" {
         set "sender" "${1}";

         if header :matches "from" "*" { set "from" "${1}"; }
         if header :matches "subject" "*" { set "subject" "${1}"; }

         deleteheader "from";
         deleteheader "to";
         deleteheader "cc";
         deleteheader "subject";

         addheader "subject" "ECHO: ${subject}";
         addheader "from" "Echo Service <echo at somedomain.tld>";
         addheader "to" "${from}";

         redirect "${sender}";
     }
}

I haven't tested the above only with sieve-test and not in the wild.

Regards,

Stephan.




More information about the dovecot mailing list