Thursday, April 5, 2018

Exchange view DSN mail contents from queue

We had some DSN mails queueing up on our Exchange server's outgoing queue with error 450 4.7.1 and i was trying to figure out what were those mails in the first place. The Subject in all those mails looked like spam and since the From Address was empty, it got me kinda worried and curius at the same time. Using Queue Viewer wasn't helpfull since I couldn't see the origin of the DSN message. I had to use Exchange Management Shell to find out more info.

In order to view the email contents so that you can check the body and find out more information about the cause/source of the DSN, you need to know the message Identity, suspend the message's from processing and then export it.

You can either find the Identity from the Queue Viewer or using PowerShell you can list all list your Message queue with one of the following commands:
Get-message | format-list
Get-message | select Identity, MessageSourceName, Subject, LastError | where {$_.MessageSourceName -eq "DSN"}
Once you have the Identity, you need to suspend the message:
Suspend-Message -Identity <YourMessageIdentity>
Export the message using the command:
Export-Message -Identity <YourMessageIdentity> | AssembleMessage -Path "<YourPath>\<Filename>.eml"
You can resume the message for further processing in your queue:
Resume-Message -Identity <YourMessageIdentity>

Now I was able to open the mail contents with notepad and investigate further on the DSN cause. In our case, as I suspected, those were NDRs for non existing mail addresses, nothing to worry about.

Further reading:

No comments: