Separate Domains with System Accounts
If you require separate namespaces for each of your virtual domains, the
configuration is only slightly more complicated. With separate domains, mail to
info@ora.com should go to a different mailbox than
mail to info@oreilly.com. In this case, do not list
the additional domains in the mydestination
parameter. Instead, use virtual_alias_domains
:
virtual_alias_domains = ora.com, oreilly.com
You must create a user account for every email address that will receive messages on your system. Your system accounts do not have to match the email addresses in any way, since you will be mapping the addresses to the accounts separately, but each account must be unique. If your platform supports long usernames, a good way to create unique account names, and to avoid confusion about which accounts are meant to receive mail at which domains, is to use the domain name itself as part of the account name. One possible naming convention is to create accounts such as info.ora.com and info.oreilly.com.
Once Postfix knows which domains to accept mail for, and you have
accounts for each address, use virtual_alias_maps
to map the email addresses to the accounts you create. In
main.cf, point the virtual_alias_maps
parameter to the virtual alias lookup file. In this example, the file
/etc/postfix/virtual_alias is
used:
virtual_alias_maps = hash:/etc/postfix/virtual_alias
The /etc/postfix/virtual_alias file contains entries with the email addresses pointing to the system ...
Get Postfix: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.