"To" header not visible in the header of the undelivered/bounced emails

Pankaj Kumar 0 Reputation points
2023-03-23T17:03:35.27+00:00

Hi,

If somebody can help here. We are monitoring a few Office365 mailboxes and read their emails. Apart from reading email subject and body, we also see what was present in the "To" header for the email and based on that we are applying certain business rules. Recently we encountered an issue where we are not able to find the "To" recipient for emails which bounced back due to delivery failure. We are using Mailkit IMAP C# library to read the emails so my questions are:

  1. Could it be issue with the Mailkit IMAP library that it is unable to find the "To" header in the undelivered/bounced emails?
  2. We also used Microsoft Graph API to test the same emails and found out that although the "To" header is present in those emails but the value shown is not correct. For example, let's say we are monitoring a mailbox sender@abc.com and using the same we sent an email to recipients@xyz.com which bounced back as a delivery failure to sender@abc.com (which we are monitoring) so in this case, the "To" header shown using Microsoft Graph API is recipients@xyz.com where as it should be shown as sender@abc.com because this is where this email came back. I hope i am able to explain it properly here.

Is someone able to help here on these points that why

  1. we are not able to see the "To" header at all using Mailkit IMAP library
  2. when using Microsoft Graph API, it shows the correct "To" address

Additional information - When we check the "Internet Headers" of the same undelivered email in the Outlook, it actually shows the "To" header with the correct value (so in the example i have given in point # 2 above, it actually shows sender@abc.com as the "To").

So another question is when the "Internet headers" shows up the actual email address then why it is not being returned using the Microsoft Graph API?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,882 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.