【发布时间】:2019-03-08 08:39:33
【问题描述】:
我能够使用以下 API 调用获取带有附件的邮件对象
https://graph.microsoft.com/v1.0/me/messages/${messageId}?$expand=attachments
我需要为将上传到我们内部 CRM 的邮件(即.eml)保存原始 MIME。
我知道人们可以用以下方式制作一个简单的.eml 文件,但我想知道是否有更简单的替代方法可以直接从 API 获取。
To: Demo-Recipient <demo@demo.example.com>
Subject: EML with attachments
X-Unsent: 0
Content-Type: multipart/mixed; boundary=--boundary_text_string
----boundary_text_string
Content-Type: text/html; charset=UTF-8
<html>
<body>
<p>Example</p>
</body>
</html>
----boundary_text_string
Content-Type: application/octet-stream; name=demo.txt
Content-Transfer-Encoding: base64
Content-Disposition: attachment
ZXhhbXBsZQ==
----boundary_text_string
Content-Type: application/octet-stream; name=demo.log
Content-Transfer-Encoding: base64
Content-Disposition: attachment
ZXhhbXBsZQ==
----boundary_text_string--
【问题讨论】:
-
我已经更新了你的问题。您实际描述的是消息的原始 MIME 文本。这在 Graph 中尚不可用,但您可以在
/beta/me/messages/{id}/$value进行早期预览。请注意,这既不受支持也没有完整记录,因此请不要在生产中使用它。 -
谢谢@MarcLaFleur,如果我在生产环境中这样做,你会建议我什么替代方案。我应该研究其他 Outlook API 吗?
-
Outlook REST API 实际上与 Graph 相同(它们在幕后是相同的 API)。目前最好的选择很可能是在您的终端上构建 MIME 版本。
标签: microsoft-graph-api eml microsoft-graph-mail