What is the best way to do complex mail filtering / redirection / re-writing in a typical virtualmin setup?
I vaguely understand that dovcot can use some sieve extension (the same thing that exim uses), I also understand that the typical virtualmin bundle of postfix+dovcot+procmail+roundcube includes procmail.
The tasks we want to do are a conditional bcc’s and message mangling and forwarding.
Conditional bcc’s. I know a little about sender_bcc_maps and recipient_bcc_maps, but we want something almost like this but subtly different. Say for example we want:
- all emails ending in
*govt.us
to be bcc’ed to mailing listtenders@example.com
- all emails ending in
*com.au
to be bcc’ed to mailing listaustralia-clients@example.com
- all other external emails (both incoming and outgoing) (i.e. not ending with
@example.com
to be bcc’ed toclients@example.com
Even a bit more complicated for the emails we forward to clients@example.com
, our crm hub spot needs the forwards to be sent as if we did a “forward” in our email client, thus the email needs to be changed to something like:
Header:
From: jason@example.com
Body:
From: {{original-from}}
{{original-body}}
So basically complex filtering. What would be a good starting point within virtualmin to tackle this?