我正在尝试使用 Microsoft 图形 API 发送电子邮件并附加包含附件的电子邮件。这是我动态创建附加电子邮件的代码:
impl
然后将 # Use https://graph.microsoft.com/v1.0/me/messages/{id} endpoint and requests library
# render response with json method
message = handler.get_email(email_id)
message["@odata.type"] = "#microsoft.graph.message"
# Use https://graph.microsoft.com/v1.0/me/messages/{id}/attachments/{id} endpoint and requests library
# render response with json method
message['attachments'] = [handler.get_attachment(email_id, attach_id) for attach_id in attachment_ids]
email_attach = {
"@odata.type": "#microsoft.graph.itemAttachment",
"name": message['subject'],
"lastModifiedDateTime": message['receivedDateTime'],
"item": message
}
添加到消息的 json 表示中,并通过 post 请求和 email_attach
端点发送。邮件已成功发送和接收,但附加电子邮件未显示任何附件。
出于测试目的,我将相同的文件附加到发送的消息中,并且它们正常显示。 谁能解释为什么附件没有显示在附件消息中?