[Sieve] Multiple email recipients, how?

Robert dovecot at groenemuis.nl
Sat Nov 23 22:50:08 EET 2019


I do know that sub-addressing with a special character is nowadays a 
normal, better, way to do it.
Unfortunately we have used this system for a very long time, starting 
around 2005... So there are a lot of existing email addresses.

I am considering changing to a new hosting company, that's why I started 
looking for a solution.  The current company has very limited 
functionality for filtering using a simple webinterface, but the system 
I described works. The new hosting company uses all the nice features 
that brought me to this mailing list and I just want to find a solution 
for the existing email addresses. (We will switch to proper 
sub-addressing for new emailaddresses if I switch to the new hosting)

 From what I understand there is no easy solution for solving this at 
the MTA level, and at the user level it is not easy to differentiate 
between multiple recipients?

I have been trying different approaches (like regexes using (?!john), 
which I couldn't get to work) and belo is hat I came up with so far.
The problem with this is that all emails to multiple recipients still 
end up in the general mailbox, but emails send only to one recipient 
works ok.
Any suggestions on improving? Or a completely different approach?

--Robert

if address :contains ["to","cc"] "john@<domain>"
{
     # only one recipient
     if address :count "eq" :comparator "i;ascii-numeric" ["to","cc"] "1"
     {
         #redirect or fileinto
         redirect "joh at example.com";
         stop;
     }
     else{
         #redirect or fileinto and continue with next filter
         redirect :copy "john at example.com";
     }
}


Ralph Seichter schreef op 23-11-2019 om 18:40:
> * Tom Hendrikx via dovecot:
>
>> There are nice tricks you can do with virtual alias maps and pcre
>> within postfix to split email to specific user accounts, which could
>> also accommodate other alias schemes than standard subaddressing (such
>> as yours).
> Postfix supports sub-addressing out of the box, simply by setting the
> "recipient_delimiter" configuration parameter[1].
>
> -Ralph
>
> [1] http://www.postfix.org/postconf.5.html#recipient_delimiter



More information about the dovecot mailing list