How to trace back bounced messages

心已入冬 提交于 2021-01-29 13:16:17

问题


I have a web services which allows me to send messages via office 365 hosted service. So far all works fine. But there is cases when an email bounces and I would like to mark that email bounced / undelivered in my CRM. In some cases the remote host returns undelivered: and the original subject as well as the email address it was send to. In case of google addresses this is not the case. So I can’t parse the subject to get the original message. Is there anywhere in the body or header any info which I could use to find the originating message that was not delivered ?


回答1:


The In-reply-to header of the bounce message should contain the original InternetMessageId of the Message you Sent message. You can either use the InternetMessageHeaders or get the SingleValueExtendedProperties property for that header eg

https://graph.microsoft.com/v1.0/me/MailFolders('Inbox')/messages/?$select=ReceivedDateTime,Sender,Subject,IsRead,inferenceClassification,InternetMessageId,parentFolderId,hasAttachments,webLink&$Top=10&$expand=SingleValueExtendedProperties($filter=Id eq 'String 0x1042')

Encoded version for the Graph Explorer preview

https://graph.microsoft.com/v1.0/me/MailFolders('Inbox')/messages/?$select=ReceivedDateTime%2cSender%2cSubject%2cIsRead%2cinferenceClassification%2cInternetMessageId%2cparentFolderId%2chasAttachments%2cwebLink&$Top=10&$expand=SingleValueExtendedProperties(%24filter%3dId+eq+%27String+0x1042%27)


来源:https://stackoverflow.com/questions/61336835/how-to-trace-back-bounced-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!