-1

I would like to know whether it is possible to sync mail between a backed-up maildir used by a decommissioned dovecot install and a live email account in cyrus, or transfer the mail from the backup to cyrus. A narrative about why we must do this follows.

We had a cPanel server with mail on it which we are in the process of migrating to a mail server that we are going to maintain in-house. The in-house Mail Server consists of Postfix+Cyrus+SOGo+LDAP(for authentication). The cPanel Server had dovecot. We are planning to use imapsync to transfer the mails between the servers.

I have tested this with 2 active mailboxes on both the servers and the transfer occurs seamlessly. However, the question is, we have copied the mail folders for the users on the cPanel server to our local server at a separate location and want to make the transfer/sync from those folders to the mailboxes.

Checking this link threw some light upon syncing between folders but both syncing a folder to an imap mailbox.

This is what the copied folder for a user at looks like (located at /some/random/location/on/the/server/me):

drwx------ 2 tester tester  16384 Jul 14 09:51 cur
-rw-r----- 1 tester tester      0 May 27 12:55 dovecot-acl-list
-rw-r----- 1 tester tester   2908 Jul 14 09:50 dovecot.index
-rw-r----- 1 tester tester 196608 Jul 14 09:51 dovecot.index.cache
-rw-r----- 1 tester tester   8712 Jul 14 09:51 dovecot.index.log
-rw-r----- 1 tester tester     13 May 27 15:45 dovecot-keywords
-rw-r----- 1 tester tester   8358 Jul 14 09:50 dovecot-uidlist
-rw------- 1 tester tester      8 Jun 22 11:06 dovecot-uidvalidity
-rw------- 1 tester tester      0 May 27 12:55 dovecot-uidvalidity.51a30a63
-rw-r----- 1 tester tester   2762 Jul 14 01:11 maildirsize
drwx------ 2 tester tester   4096 Jul 14 09:50 new
-rw-r----- 1 tester tester     44 Jun 22 11:05 subscriptions
drwx------ 2 tester tester   4096 Jul 14 01:11 tmp

This is what the destination imap location for a user looks like:

-rw------- 1 cyrus mail  781 Jul 14 10:29 1.
-rw------- 1 cyrus mail  752 Jul 14 10:33 cyrus.cache
-rw------- 1 cyrus mail  156 Jul 14 10:29 cyrus.header
-rw------- 1 cyrus mail  184 Jul 14 10:33 cyrus.index
drwx------ 2 cyrus mail 4096 Jul 14 10:32 Sent
drwx------ 2 cyrus mail 4096 Jul 14 10:29 spam

         where 1. is the mail received by this user.

To sync between the mailboxes I used the following command:

imapsync --host1 webmail.my1testserver.com --user1 [email protected] --password1 XXXXXX   --host2 localhost --user2 testuser --password2 XXXXXX

The sync happens between my mailbox whch is online and my local imap mailbox. Now, how would I sync a folder on my server to a mailbox on my server?

To clarify, the backup taken from the cPanel is in the form of folders with the folder name being the username(first part of the email address). This needs to be migrated/added to the live Cyrus mailboxes.

3 Answers 3

3

maildir_to_imap.pl can be used to copy the messages in a maildir to IMAP
mailboxes.

Usage: maildir_to_imap.pl -i <users list> -D <imapHost[:port]> 

Each line in the user list must contain a pointer to the user's maildir, his IMAP username, and his IMAP password with the values separated by commas. For example:

#  Format:  maildir,IMAP user,IMAP password

/mhub4/maildirs/[email protected],jill.thomas,password
/mhub4/maildirs/[email protected],jessi.sampson,secret

Optional arguments:

-L logfile  
-n <integer>  (The number of child processes to run, default is 1)
-d debug
-I log IMAP commands and responses
1

imapsync does not sync from Maildir to IMAP, only IMAP to IMAP servers.

To do Maildir to IMAP look at http://www.athensfbc.com/imap_tools/

1

Since this question still showed up in my searches in 2019 I am throwing out two links to projects that sync between a local Maildir repository and an IMAP server:

Also, after the death of the author of imap-tools a mirror can be found here: https://github.com/andrewnimmo/rick-sanders-imap-tools. And imapsync still does not support Maildir.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .