A Python script to convert .eml and .msg email files to plain text format. The tool also creates a combined chronologically ordered output file.
- Converts .msg (Outlook) files to plain text
- Converts .eml files to plain text
- Adds date information at the top of each file
- Creates a combined output file with all messages in chronological order
- Preserves original folder structure
- Handles timezone differences for proper chronological sorting
- Python 3.6+
- Required packages:
extract_msgbeautifulsoup4python-dateutil
- Clone this repository:
git clone https://github.com/yourusername/msgeml.git
cd msgeml- Install required packages:
pip install extract_msg beautifulsoup4 python-dateutil- Place your .eml and/or .msg files in the
inputfolder - Run the script:
python eml_to_text.py input output- The converted text files will be created in the
outputfolder - A combined chronological file named
output.txtwill also be created in the output folder
Each converted file includes:
- Date information at the top
- Full message content
- Original formatting where possible
The combined output file includes:
- A separator between messages
- Source filename reference
- Date information
- Full message content in chronological order
- PDF and DOCX attachments are not processed
- Some HTML formatting may be lost in the conversion
This project is licensed under the MIT License - see the LICENSE file for details.