Several Domains on One Email Server

A common task for virtual private servers is receiving and sending emails for several domains. Let us suppose that you need to receive e-mails for the domains “”, “” and “”.

First, configure a PTR record on your server, so that other email servers trust you and don’t mark your emails as spam. It is important that the server can be placed on a domain other than the one it receives emails for. Let us assume that the server is called “” and you already have PTR records configured for this name.

For all of the previously mentioned domains, you need to configure an MX record so that it points to our email server. This way we indicate that the email for this domain is managed by a specific server. The fact that it is located on a different domain plays no role. The result is as follows: MX 10 MX 10 MX 10

In the server settings, we have to configure it to present itself using the correct name, for which we have created a PTR record in the DNS. This means that the “/etc/postfix/” file has to contain the line:

myhostname =

Receiving and Forwarding Email

In the “/etc/postfix/” file, we need to configure the path to the file which will contain a list of the managed domains and a list of recipient addresses. The relevant line in the configuration will look like this:

virtual_alias_maps = hash:/etc/postfix/virtual

We’ll use it to input the domains, addresses and users that will have the emails from the listed addresses saved. Everything will be clearer from this example:     domain     domain     domain     petr     petr     petr     pavel      adela, martina, pavla

Then you have to let the data be processed and create a database file for Postfix

postmap /etc/postfix/virtual

If you make configuration changes other than modifying the table with recipients, you have to let Postfix reload the changes:

/etc/init.d/postfix reload
manuals/server/postfix.txt · Last modified: 2016/11/19 17:35 by Kobezda