I have set-up a mail server with Postfix, and I am currently in the process of creating virtual mailboxes with the help of Postfixadmin. I am using Courier to handle IMAP authentications, and I am having troubles with setting it up properly.
I studied the logs and narrowed down the main problem being IMAP not being able to locate the designated maildirs. That is, the maildirs do not exist.
I am able to solve the problem by manually creating the maildirs that IMAP is expecting, but I dont really see myself having to do this every time I add a mailbox. I would need it to work automatically as soon as I add virtual mailboxes via Postfixadmin.
Am I missing something?
Here are some relevant information:
Postfixadmin uses a MySQL database to look up mailboxes, and the description of the relevant table is as follows:
+------------+--------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------------------+-------+
| username | varchar(255) | NO | PRI | NULL | |
| password | varchar(255) | NO | | NULL | |
| name | varchar(255) | NO | | NULL | |
| maildir | varchar(255) | NO | | NULL | |
| quota | bigint(20) | NO | | 0 | |
| local_part | varchar(255) | NO | | NULL | |
| domain | varchar(255) | NO | MUL | NULL | |
| created | datetime | NO | | 0000-00-00 00:00:00 | |
| modified | datetime | NO | | 0000-00-00 00:00:00 | |
| active | tinyint(1) | NO | | 1 | |
+------------+--------------+------+-----+---------------------+-------+
And here is a sample record:
username = user@domain.com
password = [hashed password here]
name = User 01
maildir = user@domain.com
quota = 0
local_part = user
domain = domain.com
created = 2012-08-17 07:52:01
modified = 2012-08-17 07:52:01
active = 1
(domain.com is simply a dummy for the purpose of this question. I am using a registered domain with a working MX record.)
Here are the contents of my /etc/courier/authmysqlrc
MYSQL_SERVER 127.0.0.1
MYSQL_USERNAME [omitted]
MYSQL_PASSWORD [omitted]
MYSQL_DATABASE [omitted]
MYSQL_USER_TABLE mailbox
MYSQL_LOGIN_FIELD username
MYSQL_NAME_FIELD name
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD concat(quota,'S')
MYSQL_HOME_FIELD '/home/vmail'
MYSQL_UID_FIELD '5000'
MYSQL_GID_FIELD '5000'
(I have created the necessary UNIX user ang group for this, with the proper UID:GID of 5000:5000 )