Features

Feature Overview

Aspose.Email FOSS for C++ provides a layered API for working with Outlook MSG files and Compound File Binary (CFB) containers. The library has 26 public classes across two subsystems: CFB and MSG/MAPI.


CFB Container Access

The CFB subsystem reads and writes Microsoft Compound File Binary format — the container format underlying Outlook .msg files.

ClassPurpose
cfb_readerOpen and traverse existing CFB files
cfb_writerSerialize CFB documents to bytes or files
cfb_documentIn-memory representation of a CFB file
cfb_nodeIndividual storage or stream node in the directory tree
cfb_storageNamed storage entry
cfb_streamNamed stream with binary data

Key operations:

  • Open from file, stream, or bytes: cfb_reader::from_file(), cfb_reader::from_stream(), cfb_reader::from_bytes(), cfb_reader::from_buffer()
  • Enumerate contents: storage_ids(), stream_ids(), child_ids(), directory_entry_count()
  • Navigate by path: find_child_by_name(), resolve_path()
  • Inspect nodes: cfb_node::is_storage(), cfb_node::is_stream(), creation_time(), modified_time()
  • Write containers: cfb_writer::to_bytes(), cfb_writer::write_file(), cfb_writer::write_stream()

MSG File Read and Write

The MSG subsystem handles Outlook message format on top of CFB.

ClassPurpose
msg_readerOpen and parse MSG files
msg_writerSerialize MSG documents
msg_documentIn-memory representation of an MSG file

Key operations:

  • Open MSG files: msg_reader::from_file(), msg_reader::from_stream()
  • Inspect metadata: msg_document::major_version(), msg_document::minor_version(), msg_document::strict()
  • Write MSG files: msg_writer::to_bytes(), msg_writer::write_file(), msg_writer::write_stream()
  • Convert to CFB: msg_document::to_cfb_document() for low-level CFB access

High-Level MAPI Message API

The mapi_message class provides a high-level interface for creating, reading, and converting email messages.

Creating messages:

  • mapi_message::create() — build a new message with subject and body
  • set_subject(), set_body(), set_html_body() — set message content
  • set_sender_name(), set_sender_email_address(), set_sender_address_type() — set sender
  • set_internet_message_id() — set the Message-ID header
  • set_message_class() — set MAPI message class
  • unicode_strings() / set_unicode_strings() — control Unicode string encoding

Loading messages:

  • mapi_message::from_file() — load from a file path
  • mapi_message::from_stream() — load from an input stream
  • mapi_message::from_msg_document() — load from an msg_document

Saving messages:

  • save() — serialize to bytes, stream, or file
  • to_msg_document() — convert to an msg_document for low-level access

Attachments:

  • mapi_attachment::from_bytes(), mapi_attachment::from_stream() — load attachment data
  • mapi_attachment::is_embedded_message() — check if attachment is an embedded MSG
  • mapi_attachment::load_data() — lazy-load attachment content

MAPI properties:

  • mapi_property::property_id(), property_type(), property_tag() — property identification
  • mapi_property::set_value(), flags(), set_flags() — property manipulation
  • mapi_property_collection::remove() — remove properties from a collection

EML and MIME Conversion

Convert between Outlook MSG format and standard EML (RFC 5322 / MIME):

  • mapi_message::load_from_eml() — parse an .eml file into a mapi_message
  • mapi_message::save_to_eml() — serialize a mapi_message to EML format

Subject, body, sender, recipients, and attachments are preserved through round-trips.


Enums and Constants

EnumPurpose
common_message_property_idStandard MAPI property identifiers (subject, body, sender, attachments)
property_type_codeMAPI property type codes (integer, string, binary, time, GUID)
msg_storage_roleStorage roles within MSG files (message, recipient, attachment)
directory_object_typeCFB directory entry types (storage, stream, root)
directory_color_flagRed-black tree color flags for CFB directory entries
sector_markerSpecial sector values in CFB file allocation tables