Migrating to Dovecot

From The Network People, Inc. - Wiki
Jump to navigation Jump to search

Courier IMAP to Dovecot IMAP

Dovecot uses a different method of storing imap folder subscriptions. This invalidates current Courier user's folder subscriptions.

Many scripts and command have been shared regarding how to fix this.

One recommended script follows:

courier2dovecot.sh

#!/bin/sh
#
# courier2dovecot -- Converts a Courier maildir to Dovecot format.
# Copyright (c) 2005 Arto Bendiken. Released under the GNU GPL.
# Newest version available from http://bendiken.net/scripts/
#
# 2005-10-21 initial version for Dovecot 1.0.
#
dir="$1"
if [ -z "$dir" ] || [ "$dir" = "-?" ] || [ "$dir" = "-h" ] || [ "$dir" = "--help" ]; then
  echo "Usage: $0 maildirpath"
  exit 1
fi
if [ ! -d "$dir" ] || [ ! -e "$dir/courierimapsubscribed" ]; then
  echo "$dir is not a path to a Courier maildir"
  exit 1
fi
find $dir -name courierimapsubscribed -print0 | xargs -0r rename -v 's/courierimapsubscribed/subscriptions/'
find $dir -name subscriptions -print0 | xargs -0r sed -i 's/INBOX\.//'
find $dir -name courierimapuiddb -print0 | xargs -0r rename -v 's/courierimapuiddb/dovecot-uidlist/'
find $dir -name courierimaphieracl -print0 | xargs -0r rm -vrf
find $dir -name courierimapacl -print0 | xargs -0r rm -vf
find $dir -name courierimapkeywords -print0 | xargs -0r rm -vrf

There is now a migrating page on the Dovecot web site.

POP3 UIDL differences

Different version of courier pop3d use varying versions of UIDL. Be sure to update your dovecot.conf and set pop3_uidl_format to match the version of courier-imap you had installed. This will typically be '%v-%u' for most Mail Toaster users.

If you are migrating from qmail-qpop3d, then the UIDL format used by it is simply: %f. The UIDL format is what your POP3 client checks to see if it has downloaded a message or not. Keeping the UIDL format consistent prevents your users from having to download their entire POP3 mailbox again.

However, this may be a good time to switch UIDL to a better format such as Dovecot's default of %08Xu%08Xv which is compliant with RFC 1939.


Update Webmail settings

You must also edit the config files for squirrelmail and v-webmail if you use them. Both have INBOX. prefixes that worked just fine but must be removed to work with Dovecot. To this this in squirrelmail, something like this should work:

 cd /usr/local/www/squirrelmail
 ./configure

Then select option 3 (Folders), and remove the INBOX. prefix from 3,4, and 5.

V-webmail is similar

cd /usr/local/www/v-webmail/config
cp default.user.php local.default.user.php
vi local.default.user.php

remove the INBOX. prefix from the sent,draft, and trash folders.