Per-user sieve_before settings?

Gionatan Danti g.danti at assyoma.it
Sat Jul 11 07:25:17 EEST 2020


Il 2020-07-10 22:20 Gionatan Danti ha scritto:
> Hi all,
> I wonder if using a per-user sieve_before setting (ie: a relative path
> to user home, as ~/filter.sieve) is expected to work corretly.
> 
> Full disclaimer: I am migrating an old CentOS 6.10 box with dovecot
> 2.0.9 and an old pigenhole version. I now want to redirect emails from
> old account to new account (I have a csv with old->new address pairs).
> My first approach using a single, big filter file somewhat works, but
> it is not optimal.

Ok, after some sleep I think to have found a better solution ;)

> I am currently setting sieve_before = /var/vmail/autoreply.sieve, and
> it that file I have something as:
> 
> ...
> if header :contains "to" "aaa at olddomain.com"
> {
>         redirect "aaa at newdomain.com";
>         stop;
> }
> if header :contains "to" "bbb at olddomain.com"
> {
>         redirect "bbb at newdomain.com";
>         stop;
> }
> ...

Simply replacing 'if header :contains ...' with 'if envelope :is "to" 
...' seems to do the trick (after adding the necessary 'require 
[...,"envelope"]') . Now emails with multiple to/cc are processed a 
single time, with no duplicates or other unexpected results. Do you have 
any other suggestion?

> Using a per-user before_sieve filter file seems the right solution,
> *if* it works using multiple files rather than a single global one. If
> not, do you have any other suggestion/approach to share?

This question remains: can someone point me to the right answer?
Thanks.

-- 
Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti at assyoma.it - info at assyoma.it
GPG public key ID: FF5F32A8


More information about the dovecot mailing list