问题描述
我在这里发现了几个关于在各种邮件服务器中检测邮件状态的问题,但仍然不清楚如何使用 Outlook REST API 来完成.
I found several questions here about detecting mail status in various mail servers, but still it's unclear how to do it using Outlook REST API.
在文档中 我们可以看到请求的响应:
In documentation we can see the response for request:
GET https://graph.microsoft.com/v1.0/me/messages/AAMkADhMGAAA=
但似乎答案没有包含此类信息的字段.我还研究了对标头的请求:
But it seems like the answer doesn't have a field, which contains such information. I also looked into request for headers:
https://graph.microsoft.com/v1.0/me/mailfolders/inbox/messages?$select=subject,internetMessageHeaders
不幸的是,没有像 X-Failed-Recipients
这样的标题.
Unfortunately, there was no header like X-Failed-Recipients
.
是否有任何方法可以使用 Outlook API 获取递送状态和/或失败的收件人?
Are there any ways to get delivery status and/or failed recipients using Outlook API?
推荐答案
我的方法是像你一样获取消息详细信息和 internetMessageHeaders.
My approach to this was getting message details and the internetMessageHeaders as you have done.
首先我检查标题
Content-Type
值multipart/report
表示 DSN(交付状态通知),请参阅 RFC3461.
First I check for header
Content-Type
valuemultipart/report
which denotes a DSN (delivery status notification), see RFC3461.
GET https://graph.microsoft.com/v1.0/me/messages/<id>?$select=internetMessageHeaders
然后我得到消息的 toRecipients
属性,其中包含失败的收件人的电子邮件地址.
Then I get the toRecipients
property of the message which contains theemail address of the recipient that failed.
GET https://graph.microsoft.com/v1.0/me/messages/<id>
注意:
- 并非所有邮件服务器都遵循 RFC3461,因此某些 DSN/NDR 电子邮件可能会漏掉
- 我找不到任何说明
toRecipients
始终包含失败收件人的值的文档,但到目前为止我还没有找到相反的示例.
- Not all mail servers follow RFC3461, so some DSN/NDR emails may slip through
- I could not find any documentation saying that
toRecipients
always contains the value of the failed recipient, but so far I have yet to find an example to the contrary.
这篇关于在 Microsoft Graph/Outlook REST API 中识别 DSN(交付状态通知)或 NDR(未交付报告)和失败的收件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!