Aspose.Email FOSS for Python

API reference for aspose-email-foss 26.3 (Python 3.10+, MIT license).

All classes reside under aspose.email_foss. The primary import is:

from aspose.email_foss.msg.message import MapiMessage

Python naming convention: All methods use standard Python snake_case. For example, use msg.from_file() not msg.FromFile(), and msg.body_html() not msg.BodyHtml. Properties are accessed via getter/setter methods: msg.subject() reads the subject; msg.subject("new") sets it.


Message API

ClassDescription
MapiMessageHigh-level representation of an Outlook MSG message. Load with from_file(), create with create(), save with save(). Provides access to subject, body, HTML body, message class, recipients, and attachments.
MapiAttachmentRepresents a single attachment on a MapiMessage. Created via msg.add_attachment() or msg.add_embedded_message_attachment(). Query with storage_name(), is_embedded_message().
MapiRecipientRepresents a message recipient. Created via msg.add_recipient(). Supports To, CC, and BCC recipient types.
MapiPropertyA single MAPI property entry. Access via msg.get_property() or msg.set_property(). Carries a property tag.
MapiPropertyCollectionCollection of MAPI properties. Supports set(), get(), remove(), and iter_properties().
MapiNamedPropertyDefines a named MAPI property by string name or numeric LID within a property set.

Property Enumerations

EnumerationDescription
CommonMessagePropertyIdStandard MAPI property IDs: SUBJECT, BODY, BODY_HTML, DISPLAY_TO, DISPLAY_CC, DISPLAY_BCC, SENDER_NAME, SENDER_EMAIL_ADDRESS, MESSAGE_DELIVERY_TIME, MESSAGE_FLAGS, and more.
PropertyIdExtended property ID enumeration covering attachment and scheduling properties.
PropertyTypeCodeMAPI property type codes: PTYP_STRING, PTYP_INTEGER32, PTYP_BINARY, PTYP_BOOLEAN, PTYP_TIME, and others.

MSG Format

ClassDescription
MsgDocumentDocument-level representation of an MSG file structure. Created from MsgReader or built from a MapiMessage via to_msg_document().
MsgReaderLow-level MSG file reader. Opens from file path with from_file(). Provides access to property streams, recipient storages, and attachment storages.
MsgWriterSerializes an MsgDocument to bytes or a file with to_bytes() and write_file().
MsgStorageStorage node within an MSG document tree. Holds streams and child storages.
MsgStreamData stream within an MSG storage.
StorageLayoutDescribes the storage structure of a parsed MSG file.

CFB Format (Compound File Binary)

ClassDescription
CFBReaderLow-level reader for CFB containers. Open with from_file(). Provides sector info, directory entries, and stream data access.
CFBWriterSerializes a CFBDocument to bytes or file.
CFBDocumentIn-memory CFB document structure. Built from a CFBReader or constructed programmatically.
CFBStorageStorage node in a CFB container.
CFBStreamStream node in a CFB container.
DirectoryEntryA single directory entry in the CFB structure. Query with is_storage(), is_stream(), is_root().

Enumerations

EnumerationDescription
DirectoryObjectTypeCFB directory entry type: STORAGE_OBJECT, STREAM_OBJECT, ROOT_STORAGE_OBJECT.
DirectoryColorFlagRed-black tree color: RED, BLACK.
SectorMarkerCFB sector markers: DIFSECT, FATSECT, ENDOFCHAIN, FREESECT.

Exceptions

ClassDescription
CFBErrorRaised when a CFB container is invalid or corrupted.
MsgErrorRaised when an MSG structure is invalid.

See Also