Howtoforge published a guide about setting up virtual users and domains with Postfix, Courier and MySQL under Ubuntu Linux 7.10
Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 7.10)
This document describes how to install a Postfix mail server that is based on virtual users and domains, i.e. users and domains that are in a MySQL database. I will also demonstrate the installation and configuration of Courier (Courier-POP3, Courier-IMAP), so that Courier can authenticate against the same MySQL database Postfix uses. The resulting Postfix server is capable of SMTP-AUTH and TLS and quota (quota is not built into Postfix by default, I will show how to patch your Postfix appropriately). Passwords are stored in encrypted form in the database (most documents I found were dealing with plain text passwords which is a security risk). In addition to that, this tutorial covers the installation of Amavisd, SpamAssassin and ClamAV so that emails will be scanned for spam and viruses.
Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 7.10)