1

I have looked at the following and didn't see a solution to my issue:

Migrating from any IMAP/POP3 server to Dovecot

Creating Dovecot Master users/passwords doesn't work

Move Maildir safely on running server

Sync between two Mail Servers

I have server A that was setup with Postfix/Dovecot and using ~/Maildir format in a system users account (i.e. not virtual users). I also have server B that has been configured in the same manner, and may or may not have mails existing in ~/Maildir.

If ~/Maildir doesn't exist for a user on server B, then it seems safe to assume I can just rsync the server A ~/Maildir to server B ~/Maildir and it will preserve folders, mails read, other meta data, etc.

If ~/Maildir exists on both servers each with existing mail, how can I safely merge the data from server A into the ~/Maildir on server B? In principle the data files themselves should be unique, and it should just come down to the Dovecot meta data files that would exist on both servers.

I was looking here, but that is a generic move, and I think since the server configuration is similar if not identical, then my scenario should be much easier:

https://wiki2.dovecot.org/Migration/Dsync

This last one makes it seem trivial and oversimplified given the content of other questions. It isn't clear to me if this is intended for virtual users or system users.

https://serverfault.com/a/866298/386414


I figured I didn't have much to lose, and discovered that for a single user, I could just run:

doveadm import maildir:~/old_mail/Maildir "" all

but that imported the mails as Unread, rather than whatever state they were in for the old Maildir. How would I fix that?

I think this does more what I want, since with import you can only run it once as it will indiscriminately bring email in more than once:

doveadm sync maildir:~/old_mail/Maildir

but it still has the same problems with all mail being unread.

Brian
  • 181
  • 1
  • 11

2 Answers2

2

This answer comes late, but I literally just merged four email accounts by doing

sudo cp -a previous/Maildir/* next/Maildir

The messages which had been marked new previously were still marked new after the merge. If you wanted to be safer, you could move just the contents of the cur and new directories. The files in those directories have unique names which shouldn't conflict.

FlippingBinary
  • 270
  • 2
  • 8
1

This:

Dovecot Migration and old mails

Says this:

Maildir actually uses a unique format that makes this quite easy. Simply place the mail in new/ directory inside the mail users mailroot if you want it to show up as new. Otherwise it goes in the cur/ directory.

I'm not sure how this applies in your scenario (or even if it does) but it might be worth checking into.

Allan Wallace
  • 271
  • 1
  • 4
  • Yeah, I looked at that one (forgot to include it), but it doesn't mention anything about preserving state of the mails. I was hoping for something a bit more sophisticated either in the commands I already found, or something new. To be honest it has been a while since I used IMAP and a mail client, so I'm not even that familiar with various features to be preserved. – Brian Jun 23 '19 at 20:36