Mailserver Configuration Guide

This multi-part series started because I wasn’t able to find a guide online to build an email server that meets the specs I want. So I decided to build an email server in a test environment and then write a guide for the process while I implemented it in a production environment. If your interested in my description of the email server, you can read it below. The main purpose of this guide is to be fast and easy to follow, and this page is the Index of all the parts. The rest of the page won’t cover any configuration details. If you want to dig right in, follow the links below to walk through the process:

  1. Preparing the Server and Certificates
  2. Postfix Configuration
  3. PostgreSQL Configuration
  4. Install ViMbAdmin (Virtual Mailbox Admin)
  5. Configure Mail Filters
  6. Install and Configure Dovecot
  7. Install and Configure Roundcube
  8. Configure Restrictions

This Guide

There are a lot of guides out there on the Internet for setting up a fully-featured email server. Every guide different from the last, I have followed numerous guides to build an email server that functions the way I like. It took a lot of time and research to come up with a solution I liked, but I knew that I wanted the entire project to be 100% free and open-source.


Here is a list of the features I wanted my email server to provide:

  • 100% Free and Open-Source
  • Support for Multiple Domains
  • Ability to add/remove/manage users and domains through a web interface.
  • High level of Security with SSL encryption
  • IMAP/POP3/SMTP Functionality
  • Web-Based Email
  • Virus and Spam Protection
  • I wanted to do it all with CentOS

How I wrote it

I read through countless guides on the internet and all of them came up short, some were very close but left out some key features. In the end I decided that I was going to have to take the best parts of all the guides and combine them to create my ideal server. My mailserver was originally built on my LAN using domain.local and example.local to test the server. To enhance the test, I even configured a local BIND DNS server so that I could configure the MX filters properly. Testing with my workstation, I could send email to the domains using it’s basic Postfix configuration. Some mistakes were made, and it wasn’t perfect, but the whole purpose of creating the test environment was to figure out how I wanted to configure the real email server.

The configuration ended up taking an entire weekend on the testing server, and with all the separate applications that need to work together, I knew this would have to be divided into parts. Even after dividing the parts of the configuration, the posts still seemed quite long.


One of the problems I ran into was that postfixadmin seems old. While it occasionally sees updates on SourceForge, it doesn’t look like development is very active. ViMbAdmin has a newer look and feel to it, so I decided to go with ViMbAdmin on the production server.

Roundcube and PHP7 were also afterthoughts and therefore didn’t get installed on the testing server. I did run into some minor problems while writing the series related to that. For example the Roundcube version in the CentOS repositories doesn’t support PHP7 so I had to download the latest version from the Roundcube Website. Due to me finding these issues while I was writing the guide, I don’t think the Roundcube Configuration page is as accurate as it could be. I also ended up having to go back and change some of the Dovecot and ViMbAdmin configuration guides.


In the end I was able to build an email server that I was happy with. More importantly, it met all my requirements. I used StartSSL certificates so that my email server can provide encryption. Postfix is my Mail Transfer Agent. I used ViMbAdmin for Web Administration. Dovecot provides IMAP and POP3 support. Finally Roundcube as the Web-Mail Client.

I hope this guide helps some people configure an email server they like. Or maybe you will use it to help with some portion of your own custom email server. If you return to the top of the page, you will find links to all parts of the series. Good luck, and if you find any errors, please leave a comment on the page.  I will fix errors in the writing to be more accurate for future users.

Get started with Part 1