Pure Python CFB and Outlook MSG toolkit for reading, projecting, and writing message data.
Project description
Aspose.Email FOSS for Python
Aspose.Email FOSS for Python is a pure Python toolkit for working with:
- Compound File Binary (CFB) containers
- Outlook MSG files
- High-level MAPI-style message objects
email.message.EmailMessageconversion
It is focused on practical MSG read/write workflows in a lightweight open-source package.
Features
- Read CFB and Outlook MSG containers
- Inspect low-level storages, streams, and property bags
- Read, edit, and write messages through
MapiMessage - Work with recipients, attachments, and embedded messages
- Convert between MSG and
email.message.EmailMessage - Create new Outlook-compatible
.msgfiles in pure Python
Installation
pip install aspose-email-foss
Quick Start
from datetime import datetime, timezone
from aspose.email_foss import msg
message = msg.MapiMessage.create("Hello", "Body")
message.set_property(msg.PropertyId.SENDER_NAME, "Build Agent")
message.set_property(msg.PropertyId.SENDER_EMAIL_ADDRESS, "build.agent@example.com")
message.set_property(msg.PropertyId.MESSAGE_DELIVERY_TIME, datetime(2026, 3, 15, 10, 30, tzinfo=timezone.utc))
message.add_recipient("alice@example.com", display_name="Alice Example")
message.add_attachment("hello.txt", b"sample attachment\n", mime_type="text/plain")
message.save("example-message.msg")
with msg.MapiMessage.from_file("example-message.msg") as loaded:
email_message = loaded.to_email_message()
print(email_message["Subject"])
Package Entry Points
aspose.email_foss.msg.MapiMessage: high-level mutable MSG modelaspose.email_foss.msg.MsgReader: low-level MSG readeraspose.email_foss.msg.MsgWriter: low-level MSG writeraspose.email_foss.cfb.CFBReader: low-level CFB readeraspose.email_foss.cfb.CFBWriter: low-level CFB writer
Compatibility
Main supported scenarios:
- Read Outlook
.msgfiles - Write Outlook
.msgfiles - Inspect Compound File Binary (CFB) containers
- Convert
.msgto.eml - Convert
.emlto.msg - Work with recipients, attachments, and embedded messages
API layers:
- High-level MSG API:
aspose.email_foss.msg, centered aroundMapiMessage - Low-level MSG API:
aspose.email_foss.msg, centered aroundMsgReader,MsgWriter, andMsgDocument - Low-level CFB API:
aspose.email_foss.cfb, centered aroundCFBReader,CFBWriter, andCFBDocument
email.message.EmailMessage interop:
MapiMessage.from_email_message(...)MapiMessage.to_email_message()
Outlook-oriented behavior:
- standard message creation
- recipients
- file attachments
- embedded message attachments
- common message property defaults for practical Outlook interoperability
For the stable API summary, see PUBLIC_API.md. For runnable scenarios, see examples.
Examples
Convert MSG to EML
from aspose.email_foss import msg
with msg.MapiMessage.from_file("message.msg") as message:
email_message = message.to_email_message()
with open("message.eml", "wb") as target:
target.write(email_message.as_bytes())
Convert EML to MSG
from email import policy
from email.parser import BytesParser
from aspose.email_foss import msg
with open("message.eml", "rb") as source:
email_message = BytesParser(policy=policy.default).parse(source)
message = msg.MapiMessage.from_email_message(email_message)
message.save("message.msg")
Useful Links
- Repository: https://github.com/aspose-email-foss/Aspose.Email-FOSS-for-Python
- Aspose.Email for Python product page: https://products.aspose.com/email/python-net/
- Aspose.Email for Python documentation: https://docs.aspose.com/email/python-net/
- Aspose.Email support forum: https://forum.aspose.com/c/email/9
Development
See CONTRIBUTING.md.
Security
See SECURITY.md.
Changelog
See CHANGELOG.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aspose_email_foss-26.3.tar.gz.
File metadata
- Download URL: aspose_email_foss-26.3.tar.gz
- Upload date:
- Size: 50.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2e5b8be13671c169f7309c67ce0d54d521b4c660c6e0e8286cdf75217fbaa74
|
|
| MD5 |
5f619717fe10f9fced1a67f3fd1b89c3
|
|
| BLAKE2b-256 |
1a69489bf60a973a0a8c5d9ec59b5a1441a50d00fcf050850f3a046dc69cdb5c
|
Provenance
The following attestation bundles were made for aspose_email_foss-26.3.tar.gz:
Publisher:
release.yml on aspose-email-foss/Aspose.Email-FOSS-for-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aspose_email_foss-26.3.tar.gz -
Subject digest:
a2e5b8be13671c169f7309c67ce0d54d521b4c660c6e0e8286cdf75217fbaa74 - Sigstore transparency entry: 1110926155
- Sigstore integration time:
-
Permalink:
aspose-email-foss/Aspose.Email-FOSS-for-Python@186822abb55eb80d49c54b2f5fe13f4a8b26aedd -
Branch / Tag:
refs/tags/v26.3 - Owner: https://github.com/aspose-email-foss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@186822abb55eb80d49c54b2f5fe13f4a8b26aedd -
Trigger Event:
push
-
Statement type:
File details
Details for the file aspose_email_foss-26.3-py3-none-any.whl.
File metadata
- Download URL: aspose_email_foss-26.3-py3-none-any.whl
- Upload date:
- Size: 45.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6552466727acacf9decea4cfa2e913133c92f8619d7a1674b715d7216b6b545
|
|
| MD5 |
02575ed1270cc606e04dff8eb2eae1ef
|
|
| BLAKE2b-256 |
81087119d5a962385d6b0b842cfaa278f06b9b425bc58a6d375317307cec1ea9
|
Provenance
The following attestation bundles were made for aspose_email_foss-26.3-py3-none-any.whl:
Publisher:
release.yml on aspose-email-foss/Aspose.Email-FOSS-for-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aspose_email_foss-26.3-py3-none-any.whl -
Subject digest:
c6552466727acacf9decea4cfa2e913133c92f8619d7a1674b715d7216b6b545 - Sigstore transparency entry: 1110926170
- Sigstore integration time:
-
Permalink:
aspose-email-foss/Aspose.Email-FOSS-for-Python@186822abb55eb80d49c54b2f5fe13f4a8b26aedd -
Branch / Tag:
refs/tags/v26.3 - Owner: https://github.com/aspose-email-foss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@186822abb55eb80d49c54b2f5fe13f4a8b26aedd -
Trigger Event:
push
-
Statement type: