If I rewrite info@domain.com to vmail+public/info@domain.com, then it saved to /home/vmail/public/mailboxes/info however if I get mail to vmail+public/info@anotherdomain.com then it's saved to the same mailbox.
How can I set dovecot to save to different mailboxes?
if both users vmail@domain.com and vmail@anotherdomain.com have "append" permission to public/info, vmail+public/info@anotherdomain.com will save the message there, because that's the idea of lmtp_save_to_detail_mailbox . vmail+public/info@anotherdomain.com means: do not save to INBOX of vmail@anotherdomain.com, but to public/info with the permission of user vmail@anotherdomain.com. That applies to all other users as well.
If you want to store info@anotherdomain.com somewhere else, create another SMTP alias to another mailbox, e.g.:
info@anotherdomain.com -> vmail+public/info-anotherdomain@anotherdomain.com
Thanks, that is the trick.
I think you should reject incoming mails from outside to vmail and handle all deliveries to public through local SMTP aliases. Because "vmail" is no valid recipient anyway, isn't it?
Do you think reject in SMTP time in exim? I think, I do exactly the same. I have a list with public mails and rewrite rules for them. I use this list in an acl to check it's a public mailbox or not. Of course vmail isn't a valid recipient.
I have now a fully working system. :)
Thank you all for the very useful answers.
Regards: Laszlo Kiraly