Per-user sieve_before settings?
Gionatan Danti
g.danti at assyoma.it
Fri Jul 10 23:20:23 EEST 2020
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 at olddomain.com"
{
redirect "aaa at newdomain.com";
stop;
}
if header :contains "to" "bbb at olddomain.com"
{
redirect "bbb at 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 at olddomain.com, cc bbb at olddomain.com is evaluated *two*
times: when delivering the email to aaa at olddomain.com, with a
corresponding redirect to aaa at newdomain.com, and when delivering the
email to
bbb at olddomain.com, with *another* redirect to aaa at 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 at olddomain.com, cc bbb at olddomain.com is evaluated only in
aaa at olddomain.com context, with a corresponding single email on
aaa at 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 at assyoma.it - info at assyoma.it
GPG public key ID: FF5F32A8
More information about the dovecot
mailing list