Mail server - overview

The next few articles are aimed at showing you how to install a mail server that has the ability to utilise multiple domains and multiple users.

However, to start with, let's take an overview of the installation and install some basic packages.


Using the existing email articles has allowed us to send mail from the Slice.

That is fine for many people as all they want is to allow their application to send mail and perhaps receive mail for one domain.

This series will go much further and look at installing a complete mail server for multiple domain and multiple users.

The end result will be a mail server with secure pop and imap access as well as anti-spam and anti-virus measures in place. We will also look at installing a web interface so we can check mail from a browser.

Multiple domains and users

Having the ability to host multiple domains and users needs no real explanation except to say that whatever setup we use needs to be easily administered and easily accessed by the admin users.

There are a couple of ways of approaching how to define domains and users.

Firstly, there is the 'flat file' method. This simply uses a text file containing the relevant data.

Secondly, a database is used to control the data.


In this series, we will setup and use MySQL to control our domains, users, password, addresses and so on.

It may seem like overkill if you only have one or two domains and, indeed, it may well be for those cases.

However, once created, administering the database is very simple. Adding new users and new domains is actually easier than using the 'flat file' approach.

The finalised mail server will have the ability to host from one domain and one user to many thousands of domains and associated users.

Any extra time taken to complete the installation is well worth it when the end result is so robust and so scalable.


To control our pop and imap access to the emails, we will use the Courier package. As with most things, there are other packages available such as Dovecot.

You are free to use whichever one you prefer. However, in this case, we will install and configure Courier for our needs.

We will also configure Postfix and Courier to allow secure access to our mail using encrypted connections - similar to the way you would use an 'HTTPS' connection for sensitive information when browsing the web.

Anti-spam, anti-virus and grey lists

No mail server would be completed without some measures in place to combat spam and viruses.

The finished mail server will have anti-spam and anti-virus facilities and use a 'grey list' to block most spam before it even reaches the filters.


The mails server articles will allow you to install and configure a complete mail server that is useable by a single domain or many thousands of domains.

Secure connections and anti-spam and anti-virus make the mail server easy to use and reduce unwanted mail.

Let's get started with looking at the Slice setup.


Article Comments:

Stuart commented Sat Nov 08 02:10:55 UTC 2008:

In what order are the mailserver posts? I am finding it difficult to follow

PickledOnion commented Sat Nov 08 13:04:00 UTC 2008:


The order is exactly as listed in the email category:


Tom Kirkpatrick commented Tue Dec 09 17:32:05 UTC 2008:

How often do you write these articles? When will this (excellent) series be finished? I got all the way to the end (Adding Domains and Users to MySQL) and am a bit gutted that it stops there. From reading the blurb on this page, I thought I was going to get a web client that I could use with the setup... I'm eagerly awaiting more.!

Matt commented Sun Jan 18 14:02:44 UTC 2009:

Damn- Got all the way to the final article, to find it isn't quite finished yet!

Fantastic work so far- your tutorials are always so easy to follow.

Chris commented Thu Apr 02 23:20:16 UTC 2009:

These articles are great. I hope you can get to the spam control article soon. I love my Slicehost, but I'm not sure how many more viagra emails I can take.

Armin commented Wed Sep 23 16:27:22 UTC 2009:

there seems to be some overlapping and redundancey in your tutorials.

if we are setting up email for multiple domains and users... do we skip the following:

Email - Slice basics: Email - preparing the Slice Email - Setting a Sender Policy Framework (SPF) record

Email - Sending email from the Slice: Postfix - Installation Postfix - basic settings in Postfix - MX records and receiving emails Postfix - MX records and receiving emails Postfix - using telnet to test postfix Postfix - checking for an open relay

And go right to these:

Email - mail server setup: Mail server - overview Mail server - Slice setup Mail server - vmail user and mailboxes Mail server - Postfix and MySQL installation Mail server - creating the MySQL database Mail server - Configuring Postfix to use MySQL - part 1 Mail server - Configuring Postfix to use MySQL - part 2 Mail server - secure connection, configuring Saslauthd Mail server - secure connection, creating the SSL cert Mail server - secure connection, configuring Postfix Mail server - Courier installation Mail server - Opening ports in the firewall Mail server - adding domains and users to MySQL

trying to do this right and not mess it up


DNS commented Tue May 04 19:19:54 UTC 2010:

I am in total agreement with all of the positive responses scribed above for your tutorials.

Bingo commented Wed Sep 15 12:54:06 UTC 2010:

Mr Onion you are a great man.

You have single handedly saved mankind a man-millennium in wasted googling and confusion.

I await with bated breath for the episode on:

"Anti-spam, anti-virus and grey lists"

sdebaun commented Mon Sep 20 23:02:20 UTC 2010:

Great!! I followed as directed and am happy to say everything works as stated! However, I do feel a little left in the lurch as the series is not quite complete...

I noticed the first post above dated Nov 2008; it's been awhile...

I hope you haven't forgotten us Pickled!

And thanks again for the great work!

Jered commented Tue Sep 21 03:51:23 UTC 2010:

PickledOnion actually moved on to bigger and better things - specifically, managing Slicehost now. Expanding and revising the mail server articles is definitely on the list of things to do since those articles attract plenty of attention. The work won't be done by Pickled, but he'll certainly have veto power over whatever is done. ;) commented Fri Aug 29 08:18:33 UTC 2014:

Hello, all is going perfectly here and ofcourse every one is sharing facts, that's truly fine, keep up writing.

Feel free to surf to my blog post; (

Want to comment?

(not made public)


(use plain text or Markdown syntax)