Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.