As of recently I have set up Postfix to receive mail for any local users (present in /etc/password or /etc/aliases) and forward any system mail to an external mailbox. So far, so good, these already work as intended.
Now my question: Is it possible to put mails received on the real domain (which is assigned to mydomain in main.cf) to any virtual mailboxes?
If yes, how should I set up Postfix to handle these virtual mailboxes in conjunction with a real domain?
I don’t know what you mean by a “virtual” mailbox… A mailbox is a mailbox, I don’t know that there is any special type of mailbox.
If you’re asking whether it’s possible to route mail or a copy of mail to mailboxes other than the specified target mailbox, yes… It’s a feature of any SMTP smarthost. Instructions for however you setup your filter and routing might be in the MAN pages or the Internet.
“Virtual mailbox” means that there isn’t any account the mailbox could be associated with (in contrast to an account mailbox which requires that a user account be present on the machine the SMTP server is running on).
Since I don’t want to open up any user accounts in order to establish a mailbox, I’m going to go with said virtual mailboxes - however, that would normally imply that a so-called virtual domain be used (in contrast to the server domain that is specified in the mydomain assignment in main.cf). However, I’m looking for a way to set up virtual mailboxes without having to resort to a virtual domain (I’m somewhat loath to register yet another domain that resolves to my host).
You haven’t identified exactly what mail server software you’re using, but the following generally applies to any mail server…
As you’ve described, a mailbox doesn’t have to necessarily be associated with a User Account. But, it’s still a mailbox, I don’t think anyone refers to a mailbox without a User Account as a “virtual” mailbox.
Mail domains can be different than the FQDN used for the business or network. But, they are often the same or similar to enable easy “discovery.” So the User Account doesn’t necessarily have to match the mail address. In fact, in a very large multi-site business might create mail domains as subdomains of the corporate domain to facilitate easy routing.
So, there is at least one solution… create a subdomain rather than use a completely new domain.
Or, create any mail domain name you want without registering, it’s perfectly legal… You just need to set up some kind of registration and discovery and set up your mail server routing accordingly. Of course DNS (private or public) can be useful but is not required (You can distribute Hosts files and do other things).
After some more googling things up I found a solution that hit two birds with one stone.
So I moved the domain on which I want to receive mail out to the virtual_mailbox section and killed it in mydestination.