# Postfix Courier-Imap mail delivery problem

## bermibo

Hello,

I have set up a mailserver according to the http://www.gentoo.org/doc/en/virt-mail-howto.xml documentation and have a mail delivery problem.

I have set up the server so that there are local users such as e.g. a user named dummy.

This user has a home directory at /home/dummy.

The server is working under a domain, lets say it is domain.com

Postfix ist set up and delivers mails, courier-imap is also working.

There I have created a user for the mysql database who is also called dummy, authetification is working with email address - dummy@domain.com

The vmail directory is stored at /home/vmail/virt-domain.com/ as told in the documentation. The user dummy has his mail directory stored at

/home/vmail/virt-domain.com/dummy/.maildir and is working under the uid gid of vmail - 1200.

Postfix is set up and delivers mail to the .maildir directory of every users home directory at /home/user, in this case to /home/dummy/.maildir but not as wanted to 

/home/vmail/virt-domain.com/dummy/.maildir 

Because the uid and gid of user dummy is different from the vmail uid and gid courier-imap can't connect to the .maildir directory. Error says: 

"Account's mailbox directory is not owned by the correct uid or gid"

How can I set up postfix to deliver mails to /home/vmail/virt-domain.com/dummy/.maildir

Cheers, every help I can get is very useful,

BB

----------

## audiodef

If you're willing to try doing it differently, and in a way I think is more efficient and just (admittedly subjectively) better, check out the Postfix howto link in my sig.   :Smile: 

----------

## bermibo

Hi,

thank you, I have solved the problem. 

I've changed the users to have all vmail uid and gid and "deleted" the normal user setup. So I created user accounts under the /home/vmail/virt-domain.com/ folders for each user and changed every uid/gid to 1200 and forbid the normal login in /etc/passwd. Next step was to do a ln -s /home /username/www/ www/ in eveyones /home/vmail/virt-domain.com/username/ folder so that the www-homedir still works and of course I have to change the userdir_mod setup in the /etc/apache2/ setup.

The problem was that the mailserver also works for a domain homepage www server and the userspages lying under /home/username/www

So it was a little bit tricky to set this up.

Cheers,

BB

----------

