1. Products
  2.   Email
  3.   Python
  4.   MSG-Extractor
 
  

Open Source Python Library for Outlook® MSG Files

Free Python API enables Software Developers to Read & parse Microsoft® Outlook MSG Fiels (Emails & attachments) via Python.

What is MSG-Extractor Library?

MSG-Extractor gives software developers the ability to process Microsoft Outlook MSG files from Python apps. It automates the extraction of key email data such as from, to, cc fields as well as subject, body, date, and attachments. The Python MSG library also supports features such as reading an email message, extracting attachments, embedding MSG files, command-line arguments and save attachments to custom location. 

MSG Extractor is a very easy to use Python library helping professionals in parsing and extracting information from MSG (Microsoft Outlook Message) files. The library targets to simplify the email and attachments extraction process by providing appropriate and effective ways for accessing valuable data inside MSG files. It supports features like parsing MSG files, speedy extracting metadata from emails, extracting attachments from MSG files, automating tasks related to processing emails and so on.

Previous Next

How to Install MSG-Extractor?

Install MSG-Extractor via PyPi

 pip install extract-msg 

Open MSG File via Python

The MSG-Extractor library allows Python developers to access & read the contents of Outlook MSG files. You can access the email recipient addresses as well as view email messages & attachments. By using the following lines of code, you can easily read messages via python.

Open MSG File

  1. Open existing MSG file using extract_msg.Message() method and pass file name as parameter
  2. Get and print the sender of the email using msg.sender property
  3. Get and print the date of the email using msg.date property
  4. Get and print the subject of the email using msg.subject property
  5. Get and print the message body of the email using msg.body property

Python Dependency for MSG-Extractor

f = r'MS_Outlook_file.msg' 
# open message
msg = extract_msg.Message(f)
# print sender name
print('Sender: {}'.format(msg.sender))
# print date
print('Sent On: {}'.format(msg.date))
# print subject
print('Subject: {}'.format(msg.subject))
# print body
print('Body: {}'.format(msg.body))

Save Attachments & Messages

MSG-Extractor library enables the extraction of attachments from Outlook MSG files. The API provides the functionality to scan all the email messages stored in MSG and displays the list of messages that it finds. Users can select the attachments of their choice and save them to a chosen folder. It also allows users to delete unwanted files.

Extract Email Metadata via Ptyhon

The open source MSG Extractor library has provided complete support for extracting metadata from emails inside Python applications. Software Developers can effortlessly retrieve numerous details such as the sender's name and email address, recipients, timestamp, and many more. Moreover, when migrating data between email systems, it can be instrumental in ensuring a smooth transition by extracting and preserving crucial email information.

 English