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.
I am currently setting sieve_before = /var/vmail/autoreply.sieve, and it that file I have something as:
... if header :contains "to" "aaa@olddomain.com" { redirect "aaa@newdomain.com"; stop; } if header :contains "to" "bbb@olddomain.com" { redirect "bbb@newdomain.com"; stop; } ...
Problem is that whan an email has multiple to or cc, the filter is evaluated multiple times (one per recipient) and I end with multiple email copies on the same destination address. For example, sending and email to aaa@olddomain.com, cc bbb@olddomain.com is evaluated *two* times: when delivering the email to aaa@olddomain.com, with a corresponding redirect to aaa@newdomain.com, and when delivering the email to bbb@olddomain.com, with *another* redirect to aaa@newdomain.com (ending with two email copies).
Using a per-user filter file solves the problem, as the filter is evaluated in the context of the right user only (ie: an email sent to aaa@olddomain.com, cc bbb@olddomain.com is evaluated only in aaa@olddomain.com context, with a corresponding single email on aaa@newdomain.com). However, I would avoid manipulating the already present per-user file (roundcube.sieve), as I need to add my custom rules on top of that file. Moreover, users would be able to disable the redirect filter.
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?
Thanks.
-- Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it [1] email: g.danti@assyoma.it - info@assyoma.it GPG public key ID: FF5F32A8