On Fri, Sep 18, 2020 at 11:41:40PM +0300, Janis wrote:
What would be the best way to implement "deliver mail to multiple maildirs" through LMTP in Dovecot? Like in Postfix virtual_maps.
If you want to deliver to multiple dovecot accounts, it's easier on MTA side, making a multiple-destination alias, so your MTA will perform multiple LMTP transactions.
On the other hand, if you want to deliver multiple copies to a single dovecot account, but into several different folders, it can be done easily using a sieve script like this:
fileinto :copy "somefolder" fileinto :copy "anotherfolder" # etc.
it will leave the message in INBOX (implicit keep) if you use :copy or you can prevent it by omitting :copy in the last one. You can also put sone conditional around, so only specific emails get copied or set some flags while doing it, etc. I use it all the time, e.g. mails from this list get copied to my archive marked as read while being left in inbox for me to browse and just delete, so I don't have to move them to archive manually.
-- Piotr "Malgond" Auksztulewicz firstname@lastname.net