Server Admin: How to set up multiple mail domains

server.appserveradmin

I've got a co.uk domain set up in Server Admin on an OS X Lion server for mail. It's all running fine.

I'd like to also set up a .com domain to run through the same mail server.

Is this possible? If so can someone give me details on how to set it up – without losing the .co.uk domain?

Best Answer

Assuming you want the domains to be synonymous (e.g. richard@domain.com and richard@domain.co.uk both correspond to the same mailbox), it's pretty easy. The trick is that the relevant configuration option is available in Server Admin.app but not Server.app. To get Server Admin, install the server admin tools (v10.7.4 is here, be sure to get the version matching what you're installing on), then open /Applications/Server/Server Admin.

In Server Admin, connect to the server (if it doesn't autoconnect), then select the server name in the sidebar -> Settings in the toolbar -> Services tab -> enable the Mail service and click Save in the bottom right (note: the Save button doesn't highlight very clearly when there are settings that need saving; just get in the habit of clicking it after doing anything).

Once the Mail service is enabled, it should appear in the sidebar (although you may need to click the disclose triangle next to the server name). Select Mail in the sidebar -> Settings in the toolbar -> Advanced tab -> Hosting subtab -> add the additional domain(s) to the "Local Host Aliases" list.

Note: this configures the server to accept mail for additional domain(s). In order for this to do anything useful, you also need to add MX records to DNS for the additional domain(s), so other servers know to deliver the mail to your server.

EDIT: to handle non-synonymous ("virtual") domains, go to Server Admin -> Mail -> Settings -> Advanced -> Hosting, enable virtual hosting, and add the domain(s) to the "Locally Hosted Virtual Domains" list. Then, add aliases to your user accounts for their virtual email addresses. You can add aliases either in Server.app (right-click on a user account and choose Advanced Options), or in Workgroup Manager by adding aliases to the Short Names list.

For example, if you had domain.com as your primary domain, domain.co.uk as a host alias, and otherdomain.co.uk as a virtual domain, and your account was "richard", you would be reachable as richard@domain.com and richard@domain.co.uk, but would have no address at otherdomain.co.uk. If you added "rich@otherdomain.co.uk" as an alias for your account, you'd then also be reachable at that address (but not at rich@domain.com or rich@domain.co.uk).

Note: you can also add aliases in the file /etc/aliases (e.g. add the line "rich@otherdomain.co.uk: richard" to get the effect I described above). If you do this, run sudo newaliases and then sudo postfix reload to get the change to take effect.