virtual_alias_domains is the correct first step, but that just tells Postfix that you want to use that domain for aliases. It doesn't say what the aliases should be. For that, you need to use a virtual alias map.
First, add something like this to
virtual_alias_domains = alias.com
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_alias_maps gets you a file (
/etc/postfix/virtual) that's used as a virtual alias map. But what do you put in that file? According to the virtual(5) manpage:
The input format for the postmap(1) command is as follows:
pattern address, address, ...
When pattern matches a mail address, replace it by the corresponding address.
With lookups from indexed files such as DB or DBM, or from networked
tables such as NIS, LDAP or SQL, each user@domain query produces a
sequence of query patterns as described below. Each query pattern is sent to
each specified lookup table before trying the next query pattern, until a
match is found.
@domain address, address, ...
Redirect mail for other users in domain to address.
The lookup result is subject to address rewriting:
When the result has the form
@otherdomain, the result becomes
the same user in
otherdomain. This works only for the first
address in a multi-address lookup result.
Therefore, putting this in
/etc/postfix/virtual will achieve the full-domain alias that you want:
# map any <user>@alias.com to the matching <user>@main.com
Then, since that file is a hash table, you need to run
postmap (explanation, manpage):
You can find more information about virtual domains in the Postfix Virtual Domain HOWTO and about aliases in the Postfix Address Rewriting HOWTO.