Problems importing mbox files to Dovecot sdbox with doveadm

dovecotmbox

OK, I need a couple of rep points and I'm about to pull the pin on this…

I'm trying to import some mbox files into a Dovecot sdbox store using something along the lines of:

doveadm -D import -u user@example.com mbox:/path/to/mbox "" mailbox INBOX all

a) Why can't I specify the mbox file? mbox:/mbox-path/inbox.mbox doesn't work with mbox: mbox root directory can't be a file and all that works is renaming the file to inbox, using mbox:/mbox-path and letting it default to that: Debug: mbox: INBOX defaulted to /mbox-path/inbox.

b) So I got it to import to INBOX, but now I can't do mailbox Sent. Renamed sent.mbox to inbox, same default, but it says Error: Mailbox Sent: Mailbox sync failed: Mailbox doesn't exist: Sent. lol wtf, it's right there in front of me (yes, no, not a permissions issue).

The doveadm docs aren't super helpful on this issue. Mbox format, nope. Thought Dovecot mbox config had some clues, but nope.

Should I just try to IMAP -> IMAP in some way? IMAP to something better than mbox and import that? At least this is personal and not 47M emails or something. Should I just get the source?

If it matters, it's 2019-05-16 and: Debian 9 up to date, dovecot-core 2.2.27, mbox files are from a Google archive.

Best Answer

You need to include a trailing slash on the mbox file: doveadm -D import -u user@example.com mbox:/path/to/mbox/ Sent all

That said, I didn't have much luck with doveadm import. It ignored mbox names with non-ASCII characters, and creates files all over the place on the source. I ended up using mb2md.pl, but that's for transferring mbox to Maildir. Not sure what your options are for sdbox.