5

I have an email server running (Postfix and Dovecot). I also have an archive of a bunch of raw email files that look like this:

1492038516.M77184P7110.mail2.mysite.com,S=39609,W=40258:2,Sab

I would've used imapsync to get these onto the mail server, but they're already archived on my Mac. So I copied about 1500 of these files directly into /var/vmail/domain/user/.Sent/cur on my mail server, however, things look a bit odd in RoundCube:

enter image description here

Just dozens of pages of a single (no subject) message.

Is there some way to force Dovecot to properly reindex everything? Because something is definitely wrong here, but I have no idea how to fix it. Or if there's a better way to import raw email files, I'd love to hear it.

Jens Erat
  • 1,530
  • 2
  • 12
  • 27
ffxsam
  • 433
  • 2
  • 4
  • 9

1 Answers1

5

Usually, Dovecot is very good at recognizing broken mailboxes and fixes issue on its own. Anyway, doveadm force-resync can be used to reindex in this very case.

Anyway, you should rather use doveadm import to copy those mails back into Dovecot instead of directly fiddling with Dovecot's mailbox folders, even if using MailDir: it will prevent wrong indexes from the beginning.

Jens Erat
  • 1,530
  • 2
  • 12
  • 27
  • Because of your wonderful comment, I took a look and found `doveadm copy`, *just* before I was about to mangle things by moving files by hand. Well, dovecot would probably have recovered, but this is far far better than forcing dovecot to discover and rebuild indices after my file-system mayhem. – John Clements Jan 22 '23 at 02:09
  • Alas, links are broken. – Graham Leggett Aug 05 '23 at 12:10