Our company has various applications that send mail and occasionally generate NDRs when delivery is not possible. My task is to find a way to retrieve these NDRs to pull the original message subject, recipient, and other details. I’ve found the following function and modified it (original here):
Function Get-OutlookInBox { Add-type -assembly “Microsoft.Office.Interop.Outlook” | out-null $olFolders = “Microsoft.Office.Interop.Outlook.olDefaultFolders” -as [type] $outlook = new-object -comobject outlook.application $namespace = $outlook.GetNameSpace(“MAPI”) $folder = $namespace.getDefaultFolder($olFolders::olFolderInBox) $folder.items |where {$_.MessageClass -eq "REPORT.IPM.Note.NDR"} | FL -property * #|fl -Property MessageClass,Subject,ReceivedTime,Importance,SenderName,CC,SenderEmailAddress,SenderEmailType } #end function Get-OutlookInbox clear Get-OutlookInbox
I figured that parsing the body would be the best approach and then write the results to the eventlog or a file. Unfortunately, the body on this message class seems unreadable.
I also tried the message tracking route but unfortunately it seems to be a dead-end as the subject becomes “Returned mail: see transcript for details”
Any ideas/help is appreciated.
submitted by /u/pallytank
[link] [comments]
The post Retrieving information from Exchange 2010 NDRs appeared first on How to Code .NET.