Problem:
Lately I had the problem that some users could not log-in into their webmail(Squirrelmail). Squirrelmail answered: “ERROR: Connection dropped by IMAP server”.

Looking into the logs I found the following lines:

Jul 5 10:39:43 ms41 dovecot: imap-login: Login: user=user1>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured
Jul 5 10:39:43 ms41 dovecot: IMAP(user1): mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/user1
Jul 5 10:39:43 ms41 dovecot: IMAP(user1): Fatal: Namespace initialization failed

Solution:
Here is what I found in Internet at:
http://www.dovecot.org/list/dovecot/2011-February/057087.html

Note: I’m assuming that your incoming mailbox is an MBOX format in /var/mail/
and that you are using the maildir format for the rest of the mail folders in
/home/{username}/maildir/.
Edit the file /etc/dovecot/dovecot.conf and add the following line in the IMAP section:
protocol imap {
...................
mail_location = mbox:~/mail:INBOX=/var/mail/%u
...................
}

Restart dovecot:
/etc/init.d/dovecot restart

That’s it.