https://github.com/JoshData/convert-outlook-msg-file
Python library to convert Microsoft Outlook .msg files to .eml/MIME message files.
https://github.com/JoshData/convert-outlook-msg-file
Last synced: 11 months ago
JSON representation
Python library to convert Microsoft Outlook .msg files to .eml/MIME message files.
- Host: GitHub
- URL: https://github.com/JoshData/convert-outlook-msg-file
- Owner: JoshData
- License: mit
- Created: 2018-03-14T20:25:27.000Z (over 8 years ago)
- Default Branch: primary
- Last Pushed: 2024-07-03T01:35:26.000Z (almost 2 years ago)
- Last Synced: 2024-11-20T03:38:06.945Z (over 1 year ago)
- Language: Python
- Size: 40 KB
- Stars: 193
- Watchers: 11
- Forks: 66
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Convert Outlook .msg Files to .eml (MIME format)
================================================
This repository contains a Python 3.9+ module for
reading Microsoft Outlook .msg files and converting
them to .eml format, which is the standard MIME
format for email messages.
This project uses
[compoundfiles](https://pypi.org/project/compoundfiles/)
to navigate the .msg file structure,
[compressed-rtf](https://pypi.org/project/compressed-rtf/)
and [rtfparse](https://pypi.org/project/rtfparse/)
to unpack HTML message bodies, and
[html2text](https://pypi.org/project/html2text/) to
back-fill plain text message bodies when only an HTML body
is present.
Install the dependencies with:
pip install -r requirements.txt
(You may need to create and activate a Python virtual environment first.)
Then either convert a single file by piping:
python outlookmsgfile.py < message.msg > message.eml
Or convert a set of files:
python outlookmsgfile.py *.msg
When passing filenames as command-line arguments, a new file with `.eml`
appended to the filename is written out with the message in MIME format.
To use it in your application
import outlookmsgfile
eml = outlookmsgfile.load('my_email_sample.msg')
The ``load()`` function returns an [EmailMessage](https://docs.python.org/3/library/email.message.html#email.message.EmailMessage) instance.