API 参考 aspose-email-foss 26.3 (Python 3.10+, MIT license).
所有类位于 aspose.email_foss. 主要的导入是:
Python 命名约定: 所有方法使用标准的 Python snake_case。比如,使用 msg.from_file() 而不是 msg.FromFile(). 属性直接访问: msg.subject 读取主题;; msg.subject = 'value' 设置它。.
消息 API
| Properties | Properties |
|---|
MapiMessage | Outlook 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(). 携带属性标签。. |
MapiPropertyCollection | MAPI 属性的集合。支持 set(), get(), remove(),,以及 iter_properties(). |
MapiNamedProperty | 在属性集内通过字符串名称或数值 LID 定义具名 MAPI 属性。. |
属性枚举
| Properties | Properties |
|---|
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 枚举,涵盖附件和调度属性。. |
PropertyTypeCode | MAPI 属性类型代码:: PTYP_STRING, PTYP_INTEGER32, PTYP_BINARY, PTYP_BOOLEAN, PTYP_TIME,,以及其他。. |
MSG 格式
| Properties | Properties |
|---|
MsgDocument | MSG 文件结构的文档级表示。由以下创建 MsgReader 或从 MapiMessage 通过 to_msg_document(). |
MsgReader | 低层 MSG 文件读取器。使用文件路径打开,使用 from_file().。提供对属性流、收件人存储和附件存储的访问。. |
MsgWriter | 序列化一个 MsgDocument 为字节或使用 to_bytes() 和 write_file(). |
MsgStorage | MSG 文档树中的存储节点。保存流和子存储。. |
MsgStream | MSG 存储中的数据流。. |
StorageLayout | 描述已解析 MSG 文件的存储结构。. |
CFB 格式(Compound File Binary)
| Properties | Properties |
|---|
CFBReader | CFB 容器的底层读取器。使用以下方式打开 from_file().。提供扇区信息、目录条目和流数据访问。. |
CFBWriter | 序列化一个 CFBDocument 为字节或文件。. |
CFBDocument | 内存中的 CFB 文档结构。由以下构建: CFBReader 或以编程方式构造。. |
CFBStorage | CFB 容器中的存储节点。. |
CFBStream | CFB 容器中的流节点。. |
DirectoryEntry | CFB 结构中的单个目录条目。使用以下方式查询 is_storage(), is_stream(), is_root(). |
Properties
| Properties | Properties |
|---|
DirectoryObjectType | CFB 目录条目类型:: STORAGE_OBJECT, STREAM_OBJECT, ROOT_STORAGE_OBJECT. |
DirectoryColorFlag | 红黑树颜色:: RED, BLACK. |
SectorMarker | CFB 扇区标记:: DIFSECT, FATSECT, ENDOFCHAIN, FREESECT. |
Properties
| Properties | Properties |
|---|
CFBError | 当 CFB 容器无效或损坏时抛出。. |
MsgError | 当 MSG 结构无效时抛出。. |
另见