Mbox to Maildir Converter Tool
Mbox and Maildir are 2 mail storage formats, used by email clients/servers.
First, this is not a simple way of converting, but it is easier than having to loose your mail.
So I created the Mbox to Maildir Converter Tool.
This example is what to do for a mailbox from Thunderbird mail client using an IMAP account, and the script was built using PHP and uses the Pear Mail_Mbox package to read mbox files. This script was basically written for thunderbird style of mbox, but could probably be changed to work with other styles.
Lets say that you had an account in Thunderbird, and you removed the account, or your mail now is hosted at a new server, and they didn’t move your old mail.
If your server has changed, and your old mail is not there, when you connect to that server, it will sync with the new server and completely wipe your mail, so that it looks like you have nothing. Thunderbird however, until you compact your folders, will still have the mbox files and structure of your mail. This is a savior.
What you can do, is then find your mbox folder for that account, zip it up and move it. It is usually somewhere like:
Mac: /Users/<Username>/Library/Thunderbird/Profiles/<Profile name>/ImapMail/yourdomain.com
Windows: C:\Documents and Settings\<Windows user name>\Application Data\Thunderbird\Profiles\<Profile name>\ImapMail\yourdomain.com
With this file, you can then upload the zip file to your new server, and then use the mbox to maildir converter to rebuild your mail files and folders.
Example MBOX structure:
* Inbox main inbox file
* Inbox.sbd notice the .sbd folder with sub files/folders under the inbox.
* Inbox.sbd/Projects main projects file
* Inbox.sbd/Projects.sbd projects folder structure to contain sub mboxes
* Inbox.sbd/Projects.sbd/subfolder subfolder/mbox under projects
Usage: (best if run from command line)
* set variables in the script first then use the command below.
* php mb2md.php
If you have an questions about this script, please contact us