MsgWriter
Overview
MsgWriter is a stateless utility class that serializes an MsgDocument back to the Outlook MSG (Compound File Binary) format. It is never instantiated — both of its methods are class methods. Pair it with MsgDocument and MsgReader when you need fine-grained control over MSG structure, or use MapiMessage.save() and MapiMessage.to_bytes() for the high-level equivalent.
from aspose.email_foss.msg import MsgDocument, MsgWriter
doc = MsgDocument.from_file("input.msg")
MsgWriter.write_file(doc, "output.msg")
data = MsgWriter.to_bytes(doc)Class Methods
| Signature | Description |
|---|---|
to_bytes(document) -> bytes | Serialize an MsgDocument to in-memory MSG bytes. |
write_file(document, path) -> None | Write an MsgDocument to a .msg file at path. |