smtpd.conf(5)
for [!] domain domain virtual <users>
This rule applies to mail destined for the specified virtualdomain. This
parameter supports the ‘*’ wildcard, so that a single rule for all sub-domains
can be used, for example:
accept for domain "*.example.com" \
virtual <users> deliver to mbox
The table users holds a key-value mapping of virtual to system users. For an
example of how to configure the users table, seemakemap(8).
Also look in makemap(8) for some more details.
For it to work you will have to have a system user to handle all of the mail.
You would have to do the same with postfix and probably other mta.