MapiMessage
概述
MapiMessage 是 Aspose.Email FOSS 中用于 Python 的一个类。
可变的高级 MSG 对象,支持 MSG 和 EmailMessage 转换。
此类提供 22 个方法,用于在 Python 程序中处理 MapiMessage 对象。可用的方法包括:add_attachment、add_embedded_message_attachment、add_recipient、close、create、from_email_message、from_file、from_msg_document、get_named_property、get_property、get_property_value、iter_attachments_info,以及另外 10 个方法。安装 Aspose.Email FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性有:attachments、body、body_html、declared_attachment_count、declared_next_attachment_id、declared_next_recipient_id,以及另外 19 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
msg_reader | MsgReader | 读取 | 获取 msg reader。 |
validation_issues | tuple[str, ...] | 读取 | 获取验证问题。 |
subject | `str | None` | 读写 |
body | `str | None` | 读写 |
message_class | `str | None` | 读写 |
body_html | `str | None` | 读写 |
unicode_strings | bool | 读写 | 获取或设置 Unicode 字符串。 |
properties | MapiPropertyCollection | 读写 | 获取或设置属性。 |
recipients | list[MapiRecipient] | 读写 | 获取或设置收件人。 |
attachments | list[MapiAttachment] | 读写 | 获取或设置附件。 |
extra_streams | list[MsgStream] | 读写 | 获取或设置额外的流。 |
extra_storages | list[MsgStorage] | 读写 | 获取或设置额外的存储。 |
nameid_mapping | _NamedPropertyMapping | 读写 | 获取或设置 nameid 映射。 |
major_version | int | 读写 | 获取或设置主版本。 |
minor_version | int | 读写 | 获取或设置次要版本。 |
transaction_signature_number | int | 读写 | 获取或设置事务签名编号。 |
header_reserved_0 | bytes | 读写 | 获取或设置标头保留 0。 |
header_reserved_1 | bytes | 读写 | 获取或设置标头保留字段 1。 |
emit_store_support_mask | bool | 读写 | 获取或设置 emit store 支持掩码。 |
emit_compatibility_defaults | bool | 读写 | 获取或设置发射兼容性默认值。 |
preserve_declared_header_counts | bool | 读写 | 获取或设置保留已声明的标头计数。 |
declared_next_recipient_id | `int | None` | 读写 |
declared_next_attachment_id | `int | None` | 读写 |
declared_recipient_count | `int | None` | 读写 |
declared_attachment_count | `int | None` | 读写 |
方法
| 签名 | 描述 |
|---|---|
| `from_file(path: Path | str, strict: bool)→“MapiMessage”` |
from_msg_document(document: MsgDocument) → "MapiMessage" | 在此 MapiMessage 实例上调用 from_msg_document(document)。 |
from_email_message(email_message: EmailMessage, unicode_strings: bool) → "MapiMessage" | 在此 MapiMessage 实例上调用 from_email_message(email_message, unicode_strings)。 |
create(subject: str, body: str, unicode_strings: bool) → "MapiMessage" | 在此 MapiMessage 实例上调用 create(subject, body, unicode_strings)。 |
iter_properties() → Iterator[MapiProperty] | 在此 MapiMessage 实例上调用 iter_properties。 |
iter_property_keys(storage_stream_id: int) → Iterator[tuple[int, int]] | 在此 MapiMessage 实例上调用 iter_property_keys(storage_stream_id)。 |
| `set_property(property_id: int | CommonMessagePropertyId |
| `get_property(property_id: int | CommonMessagePropertyId |
| `get_property_value(property_id: int | CommonMessagePropertyId |
| `set_named_property(named_property: MapiNamedProperty, property_type: int | PropertyTypeCode, value: Any, flags: int)→MapiProperty` |
| `get_named_property(named_property: MapiNamedProperty, property_type: int | None)→MapiProperty |
| `add_recipient(email_address: str, display_name: str | None, recipient_type: int)→MapiRecipient` |
| `add_attachment(filename: str, data: bytes, mime_type: str | None, content_id: str |
| `add_embedded_message_attachment(message: “MapiMessage”, filename: str | None, mime_type: str |
| `save(path: Path | str)` |
to_bytes() → bytes | 在此 MapiMessage 实例上调用 to_bytes。 |
to_email_message() → EmailMessage | 在此 MapiMessage 实例上调用 to_email_message。 |
to_email_bytes() → bytes | 在此 MapiMessage 实例上调用 to_email_bytes。 |
to_email_string() → str | 在此 MapiMessage 实例上调用 to_email_string。 |
iter_attachments_info() → Iterator[MapiAttachment] | 在此 MapiMessage 实例上调用 iter_attachments_info。 |
close() | 在此 MapiMessage 实例上调用 close。 |
to_msg_document() → MsgDocument | 在此 MapiMessage 实例上调用 to_msg_document。 |