This Python script converts an MBOX file into a series of individual .eml files.
-
Install Python: Ensure you have Python 3.6 or higher installed.
-
Clone the repository:
If you have git installed, you can clone the repository using the following command:
git clone git@github.com:Riadz/mbox-to-eml.git cd mbox-to-emlIf you don't have git installed, you can download the zip file from the repository and extract it.
-
Prepare your MBOX file: Replace
all_mail.mboxwith your MBOX file, most be the same name. -
Run the script:
python main.py
-
Find your EML files: The converted
.emlfiles will be located in theoutputdirectory.
I recently needed this script to move my emails from Gmail to Outlook because my company migrated from Google Workspace to Microsoft 365, for this specific use case do the following:
- using Google Takeout, check Gmail and download the takeout.
- unzip the downloaded file, find the
Mailfolder and rename the.mboxfile inside toall_mail.mbox. - place the
all_mail.mboxfile in the same directory as this script. - run the script, and it will create an
outputfolder with all your emails in.emlformat. - go to Outlook, then Settings, then Files, from there you can select the output folder to import.
- The script assumes a standard MBOX format.
- Large MBOX files may take a significant amount of time to process.
This project is licensed under the MIT License - see the LICENSE file for details.