This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.
Differences between revisions 1 and 71 (spanning 70 versions)
Revision 1 as of 2004-06-02 23:13:26
Size: 2231
Editor: ip213-185-36-189
Comment:
Revision 71 as of 2008-08-27 15:52:35
Size: 5205
Editor: TimoSirainen
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
This page contains generic information related to migrating from another IMAP or POP3 server to Dovecot. You should read this page, and then look at the server-specific instructions:
Line 3: Line 4:
When migrating from one IMAP server to another, you should make sure that these are preserved:  * [:Migration/UW:UW-IMAP / UW-POP3]
 * [:Migration/Linuxconf:Linuxconf / VIMAP]
 * [:Migration/Courier:Courier IMAP and POP3]
 * [:Migration/Cyrus:Cyrus IMAP and POP3]
 * [:Migration/Vm-pop3d:vm-pop3d]
 * [:Migration/Teapop:teapop]
 * [:Migration/BincIMAP:Binc IMAP]
Dovecot is one of the easiest IMAP servers to migrate to because of its powerful configuration options. Dovecot can store email in both [:MailboxFormat/mbox:mbox] and [:MailboxFormat/Maildir:Maildir] formats, making it compatible with many existing servers. Dovecot is also very flexible as to where it stores the email. It supports many different databases for storing [:PasswordDatabase:passwords] [:UserDatabase:user information].
Line 5: Line 13:
 * Mailbox subscription list
  * User would be able to manually subscribe them again if you don't want to mess with it.
 * Message UIDs
  * If UIDs are lost, at the minimum clients' message cache gets cleaned
Migration involves several separate tasks. You either need to convert your data or make Dovecot read your existing data. Dovecot is very good at being compatible and configurable, so it is likely to read your existing mailboxes and user and password configurations. Tasks for conversion include:

 * [:MailLocation:Where and how to store the email]
 * [:PasswordDatabase:User authentication]
 * [:UserDatabase:User database configuration] (home directory structure, UID and GID)
== IMAP migration ==
When migrating mails from another IMAP server, you should make sure that these are preserved:

 1. Message flags
  * Lost flags can be really annoying, you most likely want to avoid it.
 1. Message UIDs and UIDVALIDITY value
  * If UIDs are lost, at the minimum clients' message cache gets cleaned and messages are re-downloaded as new.
Line 10: Line 26:
 * Message flags
  * Lost flags can be really annoying, you most likely want to avoid it.
 1. Mailbox subscription list
  * Users would be able to manually subscribe them again if you don't want to mess with it.
== POP3 migration ==
When migrating mails from another POP3 server, you should try to preserve the old UIDLs. If POP3 client is configured to keep mails in the server and the messages' UIDLs change, all the messages are downloaded again as new messages.
Line 13: Line 31:
Here's the more server-specific instructions: Some servers (UW, Cyrus) implementing both IMAP and POP3 protocols use the IMAP UID and UIDVALIDITY values for generating the POP3 UIDL values. To preserve the POP3 UIDL from such servers you'll need to preserve the IMAP UIDs and set {{{pop3_uidl_format}}} properly.
Line 15: Line 33:
= UW-IMAP = If the server doesn't use IMAP UIDs for the POP3 UIDL, you'll need to figure out another way to do it. One way is to put the UIDL value into X-UIDL: header in the mails and set {{{pop3_reuse_xuidl=yes}}}. Some POP3 servers (QPopper) write the X-UIDL: header themselves, making the migration easy.
Line 17: Line 35:
By default UW-IMAP allows access to whole home directory, and many people have chosen to store their mails in mail/ directory. This usually means that IMAP clients have set "IMAP namespace" to "mail/", which doesn't work well with Dovecot, as Dovecot by default uses mail/ directory directly. So if IMAP namespace is kept as "mail/", Dovecot would try to access "~/mail/mail/" directory. Some POP3 servers using Maildir uses the maildir base filename as the UIDL. You can use {{{pop3_uidl_format = %f}}} to do this.
Line 19: Line 37:
So, removing the prefix from IMAP clients would be the first step. Next problem is that subscribed mailboxes are listed as "mail/box" or "~/mail/box" or "~user/mail/box" in subscriptions file. You'd have to remove the mail/ directory part from all of these. The subscriptions file name is also different, UW-IMAP uses `.mailboxlist` while Dovecot uses `.subscriptions`. Here is a list of POP3 servers and how they generate their UIDs. Please update if you know more:
Line 21: Line 39:
Dovecot uses UW-IMAP compatible UID and message flag headers in mboxes, so that's not a problem.  * UW-POP3: {{{pop3_uidl_format = %08Xv%08Xu}}}
 * qmail-pop3d: {{{pop3_uidl_format = %f}}}
 * Cyrus <= 2.1.3: {{{pop3_uidl_format = %u}}}
 * Cyrus >= 2.1.4: {{{pop3_uidl_format = %v.%u}}}
 * [http://www.citadel.org Citadel] (all versions): {{{pop3_uidl_format = %u}}}
 * Dovecot 0.99: {{{pop3_uidl_format = %v.%u}}}
 * [http://www.ex-parrot.com/~chris/tpop3d/ tpop3d]:
  * Maildir: {{{pop3_uidl_format = %Mf}}} (MD5 sum of the maildir base filename in hex)
  * mbox: MD5 sum in hex of first 512 bytes of the message (or of the full message if it's less than 512 bytes).
 * [http://www.openwall.com/popa3d/ popa3d] Generates MD5 sum from a couple of headers. Dovecot uses compatible MD5 sums internally, but converts them into UIDL strings in a bit different way.
 * solid-pop3d is a derivative of popa3d and uses the same UIDL format. No configuration required.
 * [http://www.toontown.org/teapop/ teapop] 0.3.8:
  * Maildir: {{{pop3_uidl_format = %Mf}}} (MD5 sum of the maildir base filename in hex)
  * mbox: MD5 sum of the message without the following lines: Status,X-Status,Lines and Content-Length.
== IMAP <-> IMAP copying ==
If you don't care about preserving messages' UIDs, or if there isn't a simple way to preserve them, you can always migrate from another IMAP server to Dovecot by downloading the messages via IMAP from the old server and then uploading them to Dovecot via IMAP.
Line 23: Line 56:
= Courier = There are several different tools for this, for example [http://www.washington.edu/imap/ UW-IMAP]'s mailutil and [http://freshmeat.net/projects/imapsync imapsync].
Line 25: Line 58:
Courier by default uses "INBOX." as private IMAP namespace, so it has exactly the same problems as described with UW-IMAP above. === imapsync ===
Here's an example of how to run imapsync for a single user:
Line 27: Line 61:
 * Courier's `courierimapsubscribed` is compatible with Dovecot's `.subscriptions` file, just rename it and remove the "INBOX." prefixes.
 * Courier's `courierimapuiddb` is compatible with Dovecot's `dovecot-uidlist` file, just rename it.
 * Courier's message flags are compatible with Dovecot (as it's specified by Maildir specification)
 * Courier's message keywords implementation isn't Dovecot compatible and there's currently no easy way to migrate them.

= Cyrus =

See [http://madness.at/projects/ cyrus2courier], it's Dovecot-compatible. Also mirrored at [http://dovecot.org/tools/ dovecot.org].
{{{
imapsync --syncinternaldates \
  --host1 192.168.1.57 --authmech1 LOGIN --user1 leah@example.com --password1 secret \
  --host2 127.0.0.1 --authmech2 LOGIN --user2 leah@example.com --password2 secret
}}}
It is quite easy to script this for a number of users, assuming you have their passwords. Even if you do not, imapsync also supports logging in as an admin user that has the ability to copy message for sub users, and a variety of other authentication options.

Migration to Dovecot

This page contains generic information related to migrating from another IMAP or POP3 server to Dovecot. You should read this page, and then look at the server-specific instructions:

  • [:Migration/UW:UW-IMAP / UW-POP3]

  • [:Migration/Linuxconf:Linuxconf / VIMAP]

  • [:Migration/Courier:Courier IMAP and POP3]

  • [:Migration/Cyrus:Cyrus IMAP and POP3]

  • [:Migration/Vm-pop3d:vm-pop3d]
  • [:Migration/Teapop:teapop]

  • [:Migration/BincIMAP:Binc IMAP]

Dovecot is one of the easiest IMAP servers to migrate to because of its powerful configuration options. Dovecot can store email in both [:MailboxFormat/mbox:mbox] and [:MailboxFormat/Maildir:Maildir] formats, making it compatible with many existing servers. Dovecot is also very flexible as to where it stores the email. It supports many different databases for storing [:PasswordDatabase:passwords] [:UserDatabase:user information].

Migration involves several separate tasks. You either need to convert your data or make Dovecot read your existing data. Dovecot is very good at being compatible and configurable, so it is likely to read your existing mailboxes and user and password configurations. Tasks for conversion include:

  • [:MailLocation:Where and how to store the email]

  • [:PasswordDatabase:User authentication]

  • [:UserDatabase:User database configuration] (home directory structure, UID and GID)

IMAP migration

When migrating mails from another IMAP server, you should make sure that these are preserved:

  1. Message flags
    • Lost flags can be really annoying, you most likely want to avoid it.
  2. Message UIDs and UIDVALIDITY value
    • If UIDs are lost, at the minimum clients' message cache gets cleaned and messages are re-downloaded as new.
    • Some IMAP clients store metadata by assigning it to specific UID, if UIDs are changed these will be lost.
  3. Mailbox subscription list
    • Users would be able to manually subscribe them again if you don't want to mess with it.

POP3 migration

When migrating mails from another POP3 server, you should try to preserve the old UIDLs. If POP3 client is configured to keep mails in the server and the messages' UIDLs change, all the messages are downloaded again as new messages.

Some servers (UW, Cyrus) implementing both IMAP and POP3 protocols use the IMAP UID and UIDVALIDITY values for generating the POP3 UIDL values. To preserve the POP3 UIDL from such servers you'll need to preserve the IMAP UIDs and set pop3_uidl_format properly.

If the server doesn't use IMAP UIDs for the POP3 UIDL, you'll need to figure out another way to do it. One way is to put the UIDL value into X-UIDL: header in the mails and set pop3_reuse_xuidl=yes. Some POP3 servers (QPopper) write the X-UIDL: header themselves, making the migration easy.

Some POP3 servers using Maildir uses the maildir base filename as the UIDL. You can use pop3_uidl_format = %f to do this.

Here is a list of POP3 servers and how they generate their UIDs. Please update if you know more:

  • UW-POP3: pop3_uidl_format = %08Xv%08Xu

  • qmail-pop3d: pop3_uidl_format = %f

  • Cyrus <= 2.1.3: pop3_uidl_format = %u

  • Cyrus >= 2.1.4: pop3_uidl_format = %v.%u

  • [http://www.citadel.org Citadel] (all versions): pop3_uidl_format = %u

  • Dovecot 0.99: pop3_uidl_format = %v.%u

  • [http://www.ex-parrot.com/~chris/tpop3d/ tpop3d]:

    • Maildir: pop3_uidl_format = %Mf (MD5 sum of the maildir base filename in hex)

    • mbox: MD5 sum in hex of first 512 bytes of the message (or of the full message if it's less than 512 bytes).
  • [http://www.openwall.com/popa3d/ popa3d] Generates MD5 sum from a couple of headers. Dovecot uses compatible MD5 sums internally, but converts them into UIDL strings in a bit different way.

  • solid-pop3d is a derivative of popa3d and uses the same UIDL format. No configuration required.
  • [http://www.toontown.org/teapop/ teapop] 0.3.8:

    • Maildir: pop3_uidl_format = %Mf (MD5 sum of the maildir base filename in hex)

    • mbox: MD5 sum of the message without the following lines: Status,X-Status,Lines and Content-Length.

IMAP <-> IMAP copying

If you don't care about preserving messages' UIDs, or if there isn't a simple way to preserve them, you can always migrate from another IMAP server to Dovecot by downloading the messages via IMAP from the old server and then uploading them to Dovecot via IMAP.

There are several different tools for this, for example [http://www.washington.edu/imap/ UW-IMAP]'s mailutil and [http://freshmeat.net/projects/imapsync imapsync].

imapsync

Here's an example of how to run imapsync for a single user:

imapsync --syncinternaldates \
  --host1 192.168.1.57 --authmech1 LOGIN --user1 leah@example.com --password1 secret \
  --host2 127.0.0.1    --authmech2 LOGIN --user2 leah@example.com --password2 secret

It is quite easy to script this for a number of users, assuming you have their passwords. Even if you do not, imapsync also supports logging in as an admin user that has the ability to copy message for sub users, and a variety of other authentication options.

None: Migration (last edited 2010-11-02 22:24:58 by TimoSirainen)