qmail + vpopmail + Dovecot | Roberto's qmail notes


Quoting D. J. Bernstein definition

qmail is a secure, reliable, efficient, simple message transfer agent. It is designed for typical Internet-connected UNIX hosts


You can find a comprehensible introduction on how a mail server works in this page of the Dovecot site. The qmail newbie's guide to relaying by Chris Johnson is very clear. It’s very suitable reading material for someone who’s just getting started.


The aim of this short guide is NOT to teach you how a mail server works, even though by the time you’re finished reading it you will hopefully have a working e-mail server. These notes just serve as a reminder of the main steps to follow in order to build a quick installation of qmail and related software. I published them because of the lack of any up-to-date documentation concerning the qmail “distributions” I was familiar with, hoping that these notes could be useful to others out there. And I created this guide partly just because I enjoy doing this kind of thing.
Therefore, to learn in depth how a mail server works, you are invited to read carefully at least the references I will mention in each page.

Secondly, I am NOT responsible for what you do with your server :) Use my guide at your own risk.

Finally, comments, criticisms and suggestions are always welcome! :-p

Which distro?

These notes have been written without a specific Linux distribution in mind. I tested them on my Slackware virtual mail servers, both 64 and 32 bit, and a number of guys out there can confirm that it works with other common distributions.

Is this a toaster?

According to the DJB's definition of a toaster, the answer would be yes. I personally consider a toaster something a la Bill Shupp or qmailtoaster, which comes with the packages included. Since I prefer to let you check for the latest versions of everything yourself, strictly speaking this shouldn’t properly be considered a toaster. I would simply call this site “Roberto’s qmail notes” instead. At any rate, I’ve included a paragraph about qmail toasters here just to satisfy the search engines -as most people come here actually looking for a toaster :)).

Before we start...

As I am not  a native english speaker, I will gladly accept every hint to improve the understanding of this guide.

Sieve interpreter & Dovecot ManageSieve

The Pigeonhole project provides Sieve support as a plugin for Dovecot's Local Delivery Agent (LDA) and also for its LMTP service. The plugin implements a Sieve interpreter, which filters incoming messages using a script specified in the Sieve language. The Sieve script is provided by the user and, using that Sieve script, the user can customize how incoming messages are handled. Messages can be delivered to specific folders, forwarded, rejected, discarded, etc.

Dovecot Managesieve Server is a service used to manage a user's Sieve script collection.

Installing Dovecot and sieve on a vpopmail + qmail server


Dovecot is an open source IMAP and POP3 email server for Linux/UNIX-like systems, written with security primarily in mind. Dovecot is an excellent choice for both small and large installations. It's fast, simple to set up, requires no special administration and it uses very little memory.

Expunging expired Junk and Trash emails with dovecot

Of course we want to delete old Junk and Trash emails to save hard disk space. To do that, with dovecot 2.0, you don't have to enable the expire-plugin, unless you have to manage a very big server, in which case you may consider to enable it in conjunction with the dictionary service, to store the timestamps in a database.

Testing Dovecot

Testing POP3

Remember that plain text login is allowed only from localhost.

# telnet [your-IP] 110
Trying [your-IP]...
Connected to [your-IP].
Escape character is '^]'.
+OK Dovecot ready.
+OK Logged in.
+OK Logging out.
Connection closed by foreign host.

Check also the secure POP connection on port 995

openssl s_client -connect [your-IP]:995

Testing IMAP

Now let's test the IMAP server. This plain text login test is allowed only from localhost.

Running Dovecot

I have adjusted the startup script distributed by Dovecot and saved it as /usr/local/bin/dovecotctl: