Hi,
we recently had a php project with imap support. I hope I'm right with the following information.
You should be able to create a new mailbox with imap_createmailbox. But you need to connect to the server with a user that has admin privileges on that imap server in order to create new mailboxes for new users. If you e.g. want to create a new mailbox for user test you should be able to do that with
imap($stream,"user.test");
In some cases this must be
imap($stream,"user/test");
if the imap server supports usernames with dots like
imap($stream,"user/t.est");
which is configurable e.g. in cyrus imap.
That would create a new mailbox. The problem with the password is AFAIK that at least cyrus (the one we use) and maybe a lot of other imap servers authenticate users against existing system users or LDAP or anything else. So you can create new mailboxes but the user that want's to get access to his newly created mailbox has to exist in the system/LDAP or where ever.
I need more information about your imap server and the OS it is running on (we use SuSE Linux, cyrus imap and openldap)
This might sound a little bit complicated but once you get things set up correctly it should work perfectly 🙂
Regards,
Thomas