Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 "", 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?

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .