Detailed Installation Instructions

Don't get puzzled about any occurence of "cyrus" in these lines - we just use it as an example.
The user "Cyrus" can be replaced by any other username having root-like rights on your preferred IMAP server.

You can use any mailer and any database we have mentioned in the requirements, replace "MySQL" and "Postfix" accordingly...

PAM through SASL

This step is optional if you intend using something else for authentification.

Now has the time come to utilize pam_mysql. Every time a service uses SASL, which in turn uses PAM, the configuration is read from files named after that service. These files are stored in the /etc/pam.d directory.

Modify, then copy samples/pam/imap to your /etc/pam.d folder. As every service uses the same configuration, we will duplicate the file:

cp samples/pam/imap /etc/pam.d/imap
chmod 0600 /etc/pam.d/imap
ln /etc/pam.d/imap  /etc/pam.d/pop
ln /etc/pam.d/imap  /etc/pam.d/sieve
ln /etc/pam.d/imap  /etc/pam.d/smtp
ln /etc/pam.d/imap  /etc/pam.d/nntp

Openmailadmin

You will have to copy all the files to your webserver's document-root folder (or any subfolder) and run the installer by pointing your browser to setup.php.

Then, modify these (if not already done) according to what you have typed in the installer, before proceeding to step 3:

fileusers (required rights)
samples/pam/imap
samples/postfix/*
MySQL
samples/oma_mail.daimon.phpdatabase

If you don't intend to use the oma_mail.daimon, skip the last line. Using is only required if you prefer static files over letting your MTA read directly from DB.

IMAP server

Cyrus-imapd is used as an example.
If you are using any other IMAP daemon, just make sure it uses PAM for authentication and accepts the user cyrus as allmighty administrator.

Using Cyrus-imapd 2.2 or newer? Edit your /etc/imapd.conf and add this line (if not already present):

 allowusermoves: yes

Else you won't be able to rename users.

After that, make sure Cyrus-imapd accepts the admin-user, cyrus if not renamed:

 cyradm --user cyrus --auth login 127.0.0.1
 [...]
 quit

MTA

reading directly from MySQL

Postfix can read all the data directly from MySQL - if your MTA does not support this, then go ahead to the next step. You can find the required files in samples/postfix - copy them to /etc/postfix/db/.

Edit /etc/postfix/main.cf this way:

 virtual_alias_domains = mysql:/etc/postfix/db/mydestination.mysql
 virtual_alias_maps = [...],mysql:/etc/postfix/db/virtual.mysql
 sender_canonical_maps = [...],mysql:/etc/postfix/db/canonical.mysql

alternative: let the sample daemon create static files

No need for this if you had success with the previous step. This step is intended for users of other database server than MySQL, too.

On large installations you will soon realize reading directly from MySQL is slower than using static BerkeleyDB files. The latter are created by oma_mail.daimon, along with standard virtual-maps so you can use it with Exim or others without problems.

Want virtual.db and virtual.regexp be created for your MTA? Edit first lines of oma_mail.daimon.php to match your paths.

Move oma_mail.daimon.php somewhere (I prefer /usr/sbin) and have cron execute it every 30-300 minutes:

 2 */2 * * *    root  /usr/sbin/oma_mail.daimon.php4

An excerpt of /etc/postfix/main.cf for those who use Postfix:

 virtual_maps = hash:/etc/postfix/db/virtual, regexp:/etc/postfix/db/virtual.regex
 virtual_alias_domains = hash:/etc/postfix/db/domains

cleaning up

For security reasons remove these files from your DocumentRoot?-folder:

 rm -r samples/pam
 rm samples/oma_mail.daimon.* samples/postfix

running as demo without IMAP server

Change IMAP-type to "fake-imap".

In the demo, by setting a mailbox' quota, "used quota" is set to a random value.