Viewing MSG files
Recipe Difficulty: Easy
Python Version: 2.7 or 3.5
Operating System: Windows
Email messages can come in many different formats. The MSG format is another popular container for storing message content and attachments. In this example, we will learn to parse MSG files using the Outlook API.
Getting started
This recipe requires the installation of the third-party library pywin32
. This means the script will only be compatible on Windows systems. We will also need to install pywin32,
as we did in Chapter 1, Essential Scripting and File Information Recipes.
To install pywin32
, we need to access its SourceForge page at https://sourceforge.net/projects/pywin32/ and download the version that matches your Python installation. To check our Python version, we can import the sys
module and call sys.version
within an interpreter. Both the version and the architecture are important when selecting the correct pywin32
installer. We also want to confirm we have a valid installation of Outlook...