Getting Started
Getting Started with Aspose.Email FOSS for Python
Welcome to aspose-email-foss, a free, MIT-licensed Python library for reading, creating, and writing Outlook MSG files and their underlying CFB (Compound File Binary) containers. This guide takes you from a fresh environment to working with MSG files in minutes.
Prerequisites
| Requirement | Detail |
|---|---|
| Python | 3.10 or later |
| Package manager | pip |
| OS | Windows, macOS, or Linux |
| Dependencies | None — pure Python |
Installation
Install from PyPI:
pip install aspose-email-fossVerify:
from aspose.email_foss.msg import MapiMessage
print("aspose-email-foss loaded successfully.")See the Installation Guide for virtual-environment setup and verification.
What You Can Do
Once installed you can immediately:
- Read MSG files with
MapiMessage.from_file()— access subject, body, HTML body, headers, and recipients - Create MSG messages from scratch with
MapiMessage.create()— set subject, body, add recipients and attachments - Convert between MSG and email (RFC 5322) format with
to_email_message()andfrom_email_message() - Inspect low-level CFB structure with
CFBReader— iterate storages, streams, and directory entries - Write MSG files with
MapiMessage.save()orMsgWriter.write_file() - Handle attachments — add binary attachments or embed MSG messages as nested attachments
Quick Start
Read an MSG file and print its subject and recipients:
from aspose.email_foss.msg import MapiMessage
msg = MapiMessage.from_file("message.msg")
print(f"Subject: {msg.subject}")
print(f"Body: {msg.body[:200]}")
msg.save("copy.msg")
print("Saved copy.msg")Next Steps
- Installation Guide: Virtual environment setup, pip install, and verification
- Developer Guide: MSG operations, attachments, properties, and CFB structure
- Features and Functionalities: Deep-dive into every feature with Python examples