Note that e-mail forwarding doesn't happen via DNS records, it happens in the mail server. Based on my testing, you are going to need to create an MX record in the sub-domain when you you create that zone, assuming that you have other zone information. A wild-card MX record in the parent zone will be hidden by the zone. But maybe you are ok with this, if you don't need any records other than MX in the sub-zones.
As I said, that MX record isn't going to cause mail servers to cause e-mail to [email protected]
to be rewritten to go to [email protected]
, it will just cause the e-mail for [email protected]
to go to the mail server that you specify in the MX record.
The mail server will also need to be configured to handle mail for sub2.example.com
. In postfix, to make this happen automatically, it will depend somewhat on what your exact configuration is for e-mail delivery (if you are using local system accounts, or the virtual delivery agent, or a transport), but in general regex maps will be able to help. For example you could use a regex map as your virtual_maps
or local_recipient_maps
and then list a record like:
/^(.+)@.+\.example\.com$/ [email protected]
You will also need to set up the domains as Postfix virtual domains, though via regex maps you will probably be able to make this configuration static (not requiring updates for every new sub-domain you create).