A fast and efficient Python tool for splitting large .mbox email archive files into smaller chunks. Designed to prevent issues with oversized mailbox files and improve email management.
✅ Splits large .mbox files into smaller parts based on size (MB)
✅ Preserves email integrity and format
✅ Real-time progress tracking with a dynamic progress bar
✅ Automatically names output files sequentially (file_1.mbox, file_2.mbox, etc.)
✅ Works efficiently with large .mbox files
Make sure you have Python 3.x installed. Additionally, install the required dependencies:
pip install tqdm
Clone the repository and navigate to the project folder:
git clone https://github.com/gray-area/mbox-splitter.git cd mbox-splitter
Run the script with the following command:
python mbox-splitter.py <filename.mbox> <size_in_MB>
Splitting a backup.mbox file into 50MB chunks:
python mbox-splitter.py backup.mbox 50
The tool will generate new .mbox files in the same directory:
backup_1.mbox (≈ 50MB) backup_2.mbox (≈ 50MB) backup_3.mbox (remaining size)
You'll also see a progress bar tracking the email processing:
Processing Emails: 120/500 [#####-----] 40% Completed
-
Reads the .mbox file message by message.
-
Calculates each email’s size in bytes.
-
Writes messages into a new .mbox file until it reaches the specified size.
-
Creates a new .mbox file and continues processing.
✅ Python 3.x
✅ Works on Windows, macOS, and Linux
Feel free to fork this repo and submit a pull request! Any contributions, suggestions, or improvements are welcome.
MIT License. See LICENSE for details.
For questions or support, open an issue on GitHub.