I'm renting a VPS running Ubuntu, and I've installed the Postfix mail-server package on this.

I've also bought several domains. Their DNS-entries (separate DNS-records) are all set to point to my VPS using an A record. In each of the DNS-entries I've also added a MX record for mail; pointing to it's domain-name as specified in it's DNS-entry.

The DNS-entries pretty much all look like this (here with censored IP and fake domain-name):

DNS-settings for my-first-domain.com:
@     A          104.XXX.XXX.XXX          
@     MX    10   mail.my-first-domain.com.        
mail  A          104.XXX.XXX.XXX          
smtp  A          104.XXX.XXX.XXX          
www   A          104.XXX.XXX.XXX

I've set-up each domain as a separate domain - including separate MX-records for mail...

  • Should I've rather have used CNAME to make the other domains just aliases?
  • Rather than separate MX-records; should I've rather used CNAME-alias, or at least let all MX-entries point to my "main" domain?

Assuming what I've done isn't too bad and can be used, how can I set-up Postfix to handle multiple mail-domains? Either "separately" (preferable), or with the other domains just as aliases for the "main" domain?

I've created user-accounts for each of my domains, so for now having all mail to my-first-domain.com being delivered to the mailbox for my-first-domain-user would be acceptable. (Although I suppose I may make additional mail-boxes for handling some types of mail - for example, all mail to abuse on any of my domains, goes to the abuse-mailbox.)

  • So what steps must I do to set-up Postfix to handle mail sent to multiple domains?

I've also installed procmail and mailx - as well as the mutt and alpine mail-clients.


What you seem to be looking for is virtual domains.

There are good tutorials out there regarding this topic. For instance, this one: https://www.howtoforge.com/virtual-users-and-domains-with-postfix-courier-mysql-and-squirrelmail-ubuntu-12.04-lts

  • My end goal is to host several web-domains... How will virtual domains for Postfix/mail impact this? Can using virtual domains for mail be integrated for use with web-server (Apache) too? – Baard Kopperud Oct 7 '16 at 18:47
  • Web sites and Postfix virtual domains have little in common. The idea of virtual domains in Postfix is the ability to store domain information in a backend of your choice (database/LDAP/etc.) and allow a single instance of Postfix to handle multiple mail domains. Think about it as virtual hosts on Apache web server. – Alvils Berzins Oct 8 '16 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.