I ran across a requirement where in I had to find out whether the emails generated from one mailbox were getting delivered to the recipient mailbox successfully or not.
As you must be aware that all the mails that are sent or received in an Exchange organization has to be routed from the Hub Transport Server. But first, let me tell you that Hub Transport Server role is one of the five distinct roles in Exchange Server 2010.
This role is responsible to make sure that all the mails are sent to their respective mailboxes internally as well as external emails.
Now, coming to the Powershell cmdlet that will help us with tracking whether the mail is delivered to mailbox is Get-MessageTrackingLog
Our main concern here is find out that whether emails are being sent successfully or not to mailbox in question.
Note: Make sure that you typing this commands from the Hub transport Server. If not, then type Get-TransportServer and pipe it to the rest of the command. This can also be used if you have multiple Hub transport Servers in your environment.
Condition 1: Get all emails that failed or were undelivered.
Get-Messagetrackinglog -Recipients: firstname.lastname@example.org -EventID “FAIL” -Start “11/28/2014 9:00:00 AM” -End “12/15/2014 5:00:00 PM” | Format-Table Timestamp, Source, Sender, Recipients, MessageSubject
Kindly see what parameters we gave here.
First parameter that we provided was the -Recipients, you can provide a valid email address or mail enabled distribution list here.
Then we provided the parameter called -EventID, in our case we wanted the mails that did not deliver, hence the value FAIL
We also provided the start and end time.
Finally we formatted the output in table to make it look nice and clean.
Condition 2: Get all emails that were successfully received by the recipient email address.
Get-Messagetrackinglog -Recipients: email@example.com -EventID “RECEIVE” -Start “11/28/2014 9:00:00 AM” -End “12/15/2014 5:00:00 PM” | Format-Table Timestamp, Source, Sender, Recipients, MessageSubject
Everything remains same from our previous command, but only the -EventID parameter will change as we want emails that were delivered to the recipient email address.
Hope this will help people in troubleshooting in their respective environments.
Also I would like to mention that this activity can be done from the GUI as well.
All you have to do is open Exchange Management Console, click on the Toolbox section on the left pane and select Message Tracking link.
Just provide the details that it asks for and you are good to go!