Dovecot Vpopmail Setup

This was a bit tricky due to an undocumented configuration file format change in version 1.0 of Dovecot and apparently few people successfully getting it to work. These instructions may be outdated and no longer apply, but someone might find them useful.

I integrated a Dovecot 1.0 Beta with an old qmail/vpopmail installation and used the following config file:

 protocols = imap
 listen = 192.168.1.1
 ssl_disable = yes
 disable_plaintext_auth = no
 login_process_per_connection = no
 login_greeting = Ready
 mail_debug = yes

 # 89 is the UID of 'vpopmail', who owns all of the mail.
 first_valid_uid = 89

 # Not sure if this line is really necessary. See below.
 default_mail_env = maildir:/var/vpopmail/domains/%d/%n/Maildir

 protocol imap {
 }

 auth_verbose = yes
 auth_debug = yes
 auth default {
  mechanisms = plain

  passdb vpopmail {
  }

  userdb passwd {
  }

  # The magic bit! Maps the username@domain to an actual directory. The default_mail_env bit seemed to do its thing after the userdb, which in the case of vpopmail did nothing useful at all.
  userdb static {
    args = uid=89 gid=89 mail=Maildir:/var/vpopmail/domains/%d/%n/Maildir
  }

  user = vpopmail

 }

The dovecot that came with Debian doesn't have vpopmail support. I compiled it from source and enabled debugging too, since it's a bitch to debug by default.

With a different (newer?) installation of Dovecot with a different configuration file format, I had more luck with the following userdb line

 auth_userdb = static uid=1008 gid=1003 home=/home/vpopmail/domains/%d/%n/Maildir

Having maildir: in the home statement caused weird, difficult to debug permission errors.