Importing mbox to Cyrus

Andrew J Caird andrew.caird at
Tue Jul 6 09:03:46 EDT 2004

On Sun, 4 Jul 2004, Allen Unueco wrote:

> I have just installed Cyrus IMAP for the first time, everything went
> very smoothly and I was up and running any major problems.
> I'm moving from a mbox based mail system to Cyrus and I'm having some
> difficulty moving the old mail.
> I've found a few mbox2imap scripts and but none of them work completely.
> The one from worked the best, but on the
> two large mbox files I've tried both exited out with an error during
> imap.append() claiming the email had a bad header. I wish I could get
> some more detailed info regarding the 'bad header' but thats all I get.
> I'm starting the think that the mbox, some which are quite old, may have been
> muddied up by email clients over the years.
> I've seen headers (Status, X-Status,X-Keywords,X-UID,X-Sender-Ip) in the
> middle of emails and other strange things. Mozilla/Thunderbird were
> totally happy with these mbox files and I'm not sure how some of these
> things were introduced.
> One of my thoughts was to clean the mbox files. I was working on some
> scripts to remove the 'funny' things I've found. And was just wondering
> if perhaps someone else has gone through this same process and might
> know of some good tools to use.
> Has anyone had these problems before? What is the best way to bring
> legacy email into Cyrus? Anyone know of some good mbox repair/cleaning
> tools?

  In attempting a similar process, I'm using the "formail" program from
the procmail distribution to clean up mailboxes when I get that error.
The syntax is pretty simple:
	mv mbox mbox.bad ; /usr/local/bin/formail -ds < mbox.bad > mbox

Then I use mailutil from the pine distribution like:
	mailutil copy|append /path/to/username.mboxfile  \

I'm sure it's not fool proof, but it has done an OK job for me so far.

Good luck.
Cyrus Home Page:
Cyrus Wiki/FAQ:
List Archives/Info:

More information about the Info-cyrus mailing list