简体   繁体   中英

How to Convert a backup of old e-mails from Mbox to Maildir?

I had an old mailserver (squirrelmail) and it went down but I had a backup of all the messages delivered to all the e-mails, and now I created a new server (Iredmail)

The problem is that the files I have at the moment are in Mbox format as in every user has a big text file that has all the e-mails they've recieved before. And (Iredmail) has a Maildir system, I want to convert the old files then add them to the new system so users can view their old e-mails as well.

I'd recommend downloading GMime and then writing a small c/c++ program to use this library to parse your mbox files and then save each email message individually into maildir files.

You can read about the maildir format at http://cr.yp.to/proto/maildir.html - it's fairly simple.

Parsing mbox files using GMime is dead simple - you can take a look at test-mbox.c to get started.

Most Linux distributions already include gmime packages and you can install gmime via homebrew on Mac OS X.

What about

reformail -s maildrop < mbox

You need to setup maildrop, basically a file named .mailfilter with this line:

to "$HOME/.maildir/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM