linuxemailsshmboxmaildir

Convert Maildir to mbox


I'm changing hosts and I need to convert my maildir accounts on my old server to mbox on my new server.

Any ideas on the best way to do this?

I found this:

for i in new/* cur/*; do
    formail <ā€$iā€ >> ../mbox
done

But I don't really understand it. I have a basic knowledge of Linux and I have root access to my server via SSH.

Most of the Maildir folders have the following contents:

cur       
new      
tmp                 
dovecot.index.log      
dovecot-uidlist    
dovecot.index         
dovecot.index.log.2    
dovecot.index.cache  
dovecot-keywords   
subscriptions

Do I need all of that or can I ignore the dovecot files?


Solution

  • If you have access to both servers via imap (or can temporarily arrange it), you might want to consider using an imapsync tool, eg:

    http://freshmeat.net/projects/imapsync/

    If that won't work, you should be able to ignore the dovecot files, but beware that you'll likely lose information like which messages are read and any flags set on the messages. (The imapsync method would preserve all those things.)