O'Reilly logo

Postfix: The Definitive Guide by Kyle D. Dent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required