Qmail VMailMgr and Courier-Imap HOWTO

Dan Kuykendall <dan@kuykendall.org>

v1.5, 12 March 2002

Table of Contents
1. Introduction
1.1. What is Qmail and why should I use it?
1.2. What is VMailMgr and why should I use it?
1.3. What is Courier-imap and why should I use it?
1.4. Description of the components
1.5. Working configurations
1.6. History
1.7. New versions
1.9. Version History
1.10. Copyrights and Trademarks
1.11. Acknowledgements and Thanks
2. Component installation
2.1. Preparations
2.2. Install support packages
2.3. Install Qmail
2.4. Install Courier-imap
2.5. Install VMailMgr
3. Putting it all together
3.1. Basic Qmail config
3.2. Tell Qmail to use VMailMgr for authentication
3.3. Setup Courier-imap for VMailMgr
3.4. Setup virtual domain with VMailMgr
3.5. Starting the daemons
3.6. Some considerations left
3.7. Mail clients
3.8. Known bugs
3.9. The final word

1. Introduction

Qmail, VMailMgr and Courier-IMAP are a very powerful and easy to use solution, but they are not what I would consider easy to setup. I hope this document helps with that.

1.1. What is Qmail and why should I use it?

Here is the authors (Dan Bernstein) blurb:

Qmail is a secure, reliable, efficient, simple message transfer agent. It is meant as a replacement for the entire sendmail-binmail system on typical Internet-connected UNIX hosts.

It offers POP3, and IMAP (with the help of Courier-IMAP) so that you can use any mail client you prefer.

Secure: Security isn't just a goal, but an absolute requirement. Mail delivery is critical for users; it cannot be turned off, so it must be completely secure. (This is why I started writing qmail: I was sick of the security holes in sendmail and other MTAs.)

Reliable: qmail's straight-paper-path philosophy guarantees that a message, once accepted into the system, will never be lost. qmail also supports maildir, a new, super-reliable user mailbox format. Maildirs, unlike mbox files and mh folders, won't be corrupted if the system crashes during delivery. Even better, not only can a user safely read his mail over NFS, but any number of NFS clients can deliver mail to him at the same time.

Efficient: On a Pentium under BSD/OS, qmail can easily sustain 200000 local messages per day---that's separate messages injected and delivered to mailboxes in a real test! Although remote deliveries are inherently limited by the slowness of DNS and SMTP, qmail overlaps 20 simultaneous deliveries by default, so it zooms quickly through mailing lists. (This is why I finished qmail: I had to get a big mailing list set up.)

Simple: qmail is vastly smaller than any other Internet MTA. Some reasons why: (1) Other MTAs have separate forwarding, aliasing, and mailing list mechanisms. qmail has one simple forwarding mechanism that lets users handle their own mailing lists. (2) Other MTAs offer a spectrum of delivery modes, from fast+unsafe to slow+queued. qmail- send is instantly triggered by new items in the queue, so the qmail system has just one delivery mode: fast+queued. (3) Other MTAs include, in effect, a specialized version of inetd that watches the load average. qmail's design inherently limits the machine load, so qmail-smtpd can safely run from your system's inetd.

Replacement for sendmail: qmail supports host and user masquerading, full host hiding, virtual domains, null clients, list-owner rewriting, relay control, double-bounce recording, arbitrary RFC 822 address lists, cross-host mailing list loop detection, per-recipient checkpointing, downed host backoffs, independent message retry schedules, etc. In short, it's up to speed on modern MTA features. qmail also includes a drop-in ``sendmail'' wrapper so that it will be used transparently by your current UAs.

1.7. New versions

The newest version of this can be found on my homepage http://www.clearrivertech.com/linux/HOWTO as SGML source, as HTML and as TEXT. Other versions may be found in different formats at the LDP homepage http://www.linuxdoc.org/.

2. Component installation

2.1. Preparations

You have two options

I recommend using Bruce Guenter's rpm releases, since they are well patched, and its what I used for building my systems.

2.1.1. Get source rpms

You will need:

For Courier-imap you must build the source rpm from the tar file (instructions will follow).

2.1.2. Get binary rpms

Qmail does not come in binary form. Such packages are explicitly disallowed by the author of Qmail, and frustrating as it may be, I understand his reasoning.

Courier-imap does not come in binary form, unless you want to use the one I built. If you want mine, visit http://www.clearrivertech.com/linux/HOWTO/supportfiles/.

VMailMgr does not come in binary form that supports Courier-imap, unless you want to use the one I built. If you want mine, email me, and I will send it.

* For qmail, you must always compile yourself due to the license restrictions. ** For Courier-imap you must build the binary rpm from the tar file (instructions will follow) or email me for my binary rpm.

2.1.3. Get deb packages

There are multiple locations for qmail and vmailmgr deb packages. Courier-imap is part of the normal debian applications.

You can get them in the following locations:

The packages by Hon are current and even include support for courier-imap, which was a great help for me, so I am going to use a combination of them for my examples. You can of course choose the ones you want for yourself, but your results may vary.

You will need:

2.1.4. Get tarred sources (for non-RPM users)

If your system does not have, or you do not use RPMS, you can install from source.

(*) There may be minor differences in these instructions due to the use of the standard
Qmail package. Please review the documentation for Qmail and VMailMgr if any of
the files deviates from my instructions.

2.2. Install support packages

2.5. Install VMailMgr

3. Putting it all together

3.5. Starting the daemons

Starting the Qmail daemon. Qmail installs itself to autostart by some mysterious (to me) way. If you like init scripts you can get Larry Doolittle's (ldoolitta@ajlab.org) init.d script at http://qmail.area.com/init.d-script If you have the Larry's init.d script just do this.
  /etc/rc.d/init.d/qmail start

Start VMailMgr daemon
  /etc/rc.d/init.d/vmailmgrd start

Start Courier-imap damon
  /etc/rc.d/init.d/courier-imap start

3.6. Some considerations left

Qmail and the Maildirs may cause some email apps that run locally to not work. Visit the Qmail website http://www.qmail.org for details on email apps that have been patched to work with Maildirs.

Courier-imap is not as widely used as Cyrus or UWash imap servers. As such, you may suffer from minor incompatibilities. Courier-imap is extremely well written, and tries to comply with the imap definition even if it means some imap clients wont work well. For details visit the Courier-imap website http://www.inter7.com/courierimap/.

3.7. Mail clients

With the solution you should now have setup you will need to know that user accounts will be user@domain.com Netscape does not like this, so for netscape use user:domain.com

I would like to suggest that you also checkout phpGroupWare at http://www.phpgroupware.org. I have built in support for vmailmgr into it already and it can give you an end result of a full Groupware solution to fend of MS Exchange/Outlook or Lotus Domino.

If you decide to use a web based mail client, you will probably want to adjust courier-imaps MAXPERIP setting. By default it is 4, which is a bit low. Bump it up to something more sensible, like 10 - 50. Otherwise our webmail users will have problems connecting. This setting is in /usr/lib/courier-imap/etc/imapd.