Make courier automatically create a maildir

1

I'm currently setting up an email server using postfix and courier.

postfix is configured to check the email accounts into a MySQL database. For example when I send an email to "john.doe@example.com", postfix checks whether "john.doe" is in the database, and writes the mail to /var/mail/vhosts/john.doe/. If this maildir doesn't exist, postfix creates it.

courier (the POP/IMAP server) is also configured to authenticate through MySQL. When I connect to my server and authenticate with "john.doe", courier looks into the same MySQL database and knows that the emails are located in /var/mail/vhosts/john.doe/.

The problem is that courier returns an error message if the directory doesn't exist, which is what will happen for every newly created account which hasn't received an email yet. The error is simply "chdir() failed for directory /var/mail/vhosts/john.doe/".

When I want to create an email account, I have to add it to the database and create the corresponding directory. However I'd like to avoid having any access to the filesystem if possible.

Is there a way for courier to automatically create the directory, or to return "no email in the inbox" if the directory doesn't exist?

Tomaka17

Posted 2012-04-19T11:52:32.893

Reputation: 133

Answers

0

There can't be an error "no email in the inbox" because there is no inbox and the server has no clue what to do.

You already know about the correct solution. Simply create the folder when you create the account.

But, I understand, you don't want to mess with the file system when you create the account. Nevertheless, you might want to give PostfixAdmin a look, it can help with the process.

If you really don't want to touch the file system, simply send the user a welcome email. It will be received by Postfix and Postfix will create the directory.

Der Hochstapler

Posted 2012-04-19T11:52:32.893

Reputation: 77 228