Search code examples
emailoutlooklotus

Get the failure reason from a mail in outlook


I am doing some automation on outlook mail box, previously it was lotus notes.So i am looking for equivalent properties in outlook. The lotus notes mail items has a item named FAILUREREASON which has the details about why the email is failed such as delivery failure reason etc. This item will be available when the mail is a delivery failure email. So when i loop through mails in inbox i can recognize which mail is a delivery failure email in inbox and which is actual required mail to be processed. But in outlook MailItem object i didn't find any option to get it. I searched for any solutuion but not able to find any. We can search subject for words such as 'failure' but it's not good approach. Can anyone know the property that i need to look or any other approach for the same.


Solution

  • Standard bounce or undeliverable emails are received in Outlook as special items using the "REPORT.IPM.Note.NDR" message class and are available as a ReportItem object in the Outlook Object Model. You can also read the mail header information via the PR_TRANSPORT_MESSAGE_HEADERS_W MAPI property on any kind of email.

    One way of retrieving the value is by using PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001F")