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 accounts you created, plus any non-local forwarding you need:

info@ora.com helene@localhost info@oreilly.com frank@localhost kdent@oreilly.com kyle.dent@onlamp.com

Whenever you create or update a virtual aliases file, don't forget to execute the postmap command on the file:

# postmap virtual_alias

If helene and frank plan to send messages from the system, you may also want to set up canonical maps so that their outbound messages show the correct sending addresses. Assign a lookup table like the following to canonical_maps:

helene info@ora.com frank info@oreilly.com

And remember to execute postmap against the file:

# postmap canonical

Категории