Skip to main content

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.EmailMessage conversion

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 .msg files 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 model
  • aspose.email_foss.msg.MsgReader: low-level MSG reader
  • aspose.email_foss.msg.MsgWriter: low-level MSG writer
  • aspose.email_foss.cfb.CFBReader: low-level CFB reader
  • aspose.email_foss.cfb.CFBWriter: low-level CFB writer

Compatibility

Main supported scenarios:

  • Read Outlook .msg files
  • Write Outlook .msg files
  • Inspect Compound File Binary (CFB) containers
  • Convert .msg to .eml
  • Convert .eml to .msg
  • Work with recipients, attachments, and embedded messages

API layers:

  • High-level MSG API: aspose.email_foss.msg, centered around MapiMessage
  • Low-level MSG API: aspose.email_foss.msg, centered around MsgReader, MsgWriter, and MsgDocument
  • Low-level CFB API: aspose.email_foss.cfb, centered around CFBReader, CFBWriter, and CFBDocument

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

Development

See CONTRIBUTING.md.

Security

See SECURITY.md.

Changelog

See CHANGELOG.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aspose_email_foss-26.3.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aspose_email_foss-26.3-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

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

Hashes for aspose_email_foss-26.3.tar.gz
Algorithm Hash digest
SHA256 a2e5b8be13671c169f7309c67ce0d54d521b4c660c6e0e8286cdf75217fbaa74
MD5 5f619717fe10f9fced1a67f3fd1b89c3
BLAKE2b-256 1a69489bf60a973a0a8c5d9ec59b5a1441a50d00fcf050850f3a046dc69cdb5c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aspose_email_foss-26.3-py3-none-any.whl.

File metadata

File hashes

Hashes for aspose_email_foss-26.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c6552466727acacf9decea4cfa2e913133c92f8619d7a1674b715d7216b6b545
MD5 02575ed1270cc606e04dff8eb2eae1ef
BLAKE2b-256 81087119d5a962385d6b0b842cfaa278f06b9b425bc58a6d375317307cec1ea9

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page