Aspose.Email FOSS for Python

API 参考 aspose-email-foss 26.3 (Python 3.10+, MIT license).

所有类位于 aspose.email_foss. 主要的导入是:

from aspose.email_foss.msg import MapiMessage

Python 命名约定: 所有方法使用标准的 Python snake_case。比如,使用 msg.from_file() 而不是 msg.FromFile(). 属性直接访问: msg.subject 读取主题;; msg.subject = 'value' 设置它。.


消息 API

PropertiesProperties
MapiMessageOutlook MSG 消息的高级表示。使用以下方式加载 from_file(), 使用以下方式创建 create(), 使用以下方式保存 save(). 提供对主题、正文、HTML 正文、消息类、收件人和附件的访问。.
MapiAttachment表示单个附件位于 MapiMessage. 通过 msg.add_attachment()msg.add_embedded_message_attachment(). 使用 storage_name(), is_embedded_message().
MapiRecipient表示消息收件人。通过 msg.add_recipient(). 支持 To、CC 和 BCC 收件人类型。.
MapiProperty单个 MAPI 属性条目。通过 msg.get_property()msg.set_property(). 携带属性标签。.
MapiPropertyCollectionMAPI 属性的集合。支持 set(), get(), remove(),,以及 iter_properties().
MapiNamedProperty在属性集内通过字符串名称或数值 LID 定义具名 MAPI 属性。.

属性枚举

PropertiesProperties
CommonMessagePropertyId标准 MAPI 属性 ID:: SUBJECT, BODY, BODY_HTML, DISPLAY_TO, DISPLAY_CC, DISPLAY_BCC, SENDER_NAME, SENDER_EMAIL_ADDRESS, MESSAGE_DELIVERY_TIME, MESSAGE_FLAGS,,以及更多。.
PropertyId扩展属性 ID 枚举,涵盖附件和调度属性。.
PropertyTypeCodeMAPI 属性类型代码:: PTYP_STRING, PTYP_INTEGER32, PTYP_BINARY, PTYP_BOOLEAN, PTYP_TIME,,以及其他。.

MSG 格式

PropertiesProperties
MsgDocumentMSG 文件结构的文档级表示。由以下创建 MsgReader 或从 MapiMessage 通过 to_msg_document().
MsgReader低层 MSG 文件读取器。使用文件路径打开,使用 from_file().。提供对属性流、收件人存储和附件存储的访问。.
MsgWriter序列化一个 MsgDocument 为字节或使用 to_bytes()write_file().
MsgStorageMSG 文档树中的存储节点。保存流和子存储。.
MsgStreamMSG 存储中的数据流。.
StorageLayout描述已解析 MSG 文件的存储结构。.

CFB 格式(Compound File Binary)

PropertiesProperties
CFBReaderCFB 容器的底层读取器。使用以下方式打开 from_file().。提供扇区信息、目录条目和流数据访问。.
CFBWriter序列化一个 CFBDocument 为字节或文件。.
CFBDocument内存中的 CFB 文档结构。由以下构建: CFBReader 或以编程方式构造。.
CFBStorageCFB 容器中的存储节点。.
CFBStreamCFB 容器中的流节点。.
DirectoryEntryCFB 结构中的单个目录条目。使用以下方式查询 is_storage(), is_stream(), is_root().

Properties

PropertiesProperties
DirectoryObjectTypeCFB 目录条目类型:: STORAGE_OBJECT, STREAM_OBJECT, ROOT_STORAGE_OBJECT.
DirectoryColorFlag红黑树颜色:: RED, BLACK.
SectorMarkerCFB 扇区标记:: DIFSECT, FATSECT, ENDOFCHAIN, FREESECT.

Properties

PropertiesProperties
CFBError当 CFB 容器无效或损坏时抛出。.
MsgError当 MSG 结构无效时抛出。.

另见

 中文