Quantcast
Channel: Practical 365
Viewing all articles
Browse latest Browse all 515

Tracking Read Status of Email Messages in Exchange Server

$
0
0

Shiva asks whether there is a way to determine if the recipients of an email have read the email message or not.

Message tracking searches already gives us the ability to determine whether an email message was delivered, but not whether the item has been read yet. To find that out, we need to look at delivery reports.

Delivery reports are available in Exchange organizations, but read tracking is not enabled by default. You can check whether read tracking is enabled in your organization with the Get-OrganizationConfig cmdlet.

[PS] C:\>Get-OrganizationConfig | Select ReadTrackingEnabled
ReadTrackingEnabled : False

If read tracking isn’t already enabled, then you won’t be able to track the read status of messages that have already been sent. If you’d like to be able to track the messages in future, turn it on now.

[PS] C:\>Set-OrganizationConfig -ReadTrackingEnabled $true

There is also a per-mailbox setting. By default, read tracking is enabled for mailboxes, so once you have turned it on for the organization it will work for all of your mailboxes. But, some mailboxes might be sensitive and need to be excluded from these types of searches. In that case, you can use Set-Mailbox to disable read status tracking for those mailboxes.

[PS] C:\>Set-Mailbox john.smythe@contoso.com -MessageTrackingReadStatusEnabled $false

Now let’s look at an example of reporting on the read status of an email. To start with, it helps to know the message ID. One of the ways you can retrieve this is with a message tracking log search. Consider a scenario in which the user Mike Nash has sent a company newsletter to all staff within the last 48 hours. We can search message tracking logs for that message, and return the message ID.

[PS] C:\>Get-MessageTrackingLog -Sender mike.nash@contoso.com -MessageSubject "Company newsletter" -Start (Get-Date).AddHours(-48) -EventId RECEIVE | Select MessageID
MessageId
---------
<b4699b83d1084712b2b746582ceedc15@contoso.com>

Next, we can perform a message tracking report search for Mike’s mailbox using Search-MessageTrackingReport. For convenience, capture the results into a variable.

[PS] C:\>$msg = Search-MessageTrackingReport -Identity mike.nash@contoso.com -BypassDelegateChecking -MessageId b4699b83d1084712b2b746582ceedc15@contoso.com
[PS] C:\>$msg.count
1

As you can see, by searching for the message ID, we get one result, rather than needing to filter through multiple results. But we’re not there yet, so far the information that has been retrieved doesn’t provide the answer we want.

[PS] C:\>$msg
RunspaceId              : 2dca05a6-56a9-4c0e-9c83-de6bc08bb5f0
MessageTrackingReportId : Message-Id=<b4699b83d1084712b2b746582ceedc15@contoso.com>,Server=ny-exch01.contoso.com,Intern
                          al-Id=0,Sender=1f67d9e7-982c-4b1e-878f-3e55f947b5e1,Domain=contoso.com
SubmittedDateTime       : 6/9/2016 6:31:01 AM
Subject                 : Email to all staff
FromAddress             : Mike.Nash@contoso.com
FromDisplayName         : Mike Nash
RecipientAddresses      : {AllStaff@contoso.com}
RecipientDisplayNames   : {All Staff}
Identity                :
IsValid                 : True
ObjectState             : New

Next, retrieve a delivery report by running Get-MessageTrackingReport for that message tracking report ID that has been returned in the search results. Again, capture the results in a variable for ease of handling.

[PS] C:\>$report = Get-MessageTrackingReport -Identity $msgs.MessageTrackingReportId -BypassDelegateChecking

Now take a look at the report.

[PS] C:\>$report
RunspaceId              : 2dca05a6-56a9-4c0e-9c83-de6bc08bb5f0
MessageTrackingReportId : Message-Id=<b4699b83d1084712b2b746582ceedc15@contoso.com>,Server=ny-exch01.contoso.com,Intern
                          al-Id=0,Sender=1f67d9e7-982c-4b1e-878f-3e55f947b5e1,Domain=contoso.com
SubmittedDateTime       : 6/9/2016 6:31:01 AM
Subject                 : Email to all staff
FromAddress             : Mike.Nash@contoso.com
FromDisplayName         : Mike Nash
RecipientAddresses      : {AllStaff@contoso.com}
RecipientDisplayNames   : {All Staff}
DeliveredCount          : 25
PendingCount            : 0
UnsuccessfulCount       : 0
TransferredCount        : 0
RecipientTrackingEvents : {Apurva.Dalia@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Jim.Daly@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Ryan.Danner@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Mike.Danseglio@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Alex.Darrow@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Shannon.Dascher@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          WillsonRaj.David@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Dan.Jump@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Michael.Jurek@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Reto.Kch@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Dalibor.Kacmar@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Wendy.Kahn@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Sandeep.Kaliyath@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Mandar.Naik@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Ranjith.Narayanan@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Mike.Nash@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z...}
Identity                :
IsValid                 : True
ObjectState             : New

The recipient tracking events are what we can use to determine who has opened the email message. Here’s one of the results from that list.

[PS] C:\>$report.RecipientTrackingEvents[0]
Date                 : 6/9/2016 6:31:10 AM
RecipientAddress     : Apurva.Dalia@contoso.com
RecipientDisplayName : Apurva Dalia
Status               : Delivered
EventType            : Deliver
EventDescription     : The message was successfully delivered.
EventData            :
Server               :
Identity             :
IsValid              : True
ObjectState          : New

So from a reporting perspective, the RecipientDisplayName and Status fields are of most interest.

[PS] C:\>$report.RecipientTrackingEvents | Select RecipientDisplayName,Status
RecipientDisplayName    Status
--------------------    ------
Apurva Dalia         Delivered
Jim Daly             Delivered
Ryan Danner          Delivered
Mike Danseglio       Delivered
Alex Darrow          Delivered
Shannon Dascher      Delivered
WillsonRaj David     Delivered
Dan Jump             Delivered
Michael Jurek        Delivered
Reto Käch            Delivered
Dalibor Kacmar       Delivered
Wendy Kahn           Delivered
Sandeep Kaliyath     Delivered
Mandar Naik          Delivered
Ranjith Narayanan    Delivered
Mike Nash            Delivered
KirkJ. Nason         Delivered
Mrina Natarajan      Delivered
Dave Natsuhara       Delivered
Mark Steele          Delivered
Heidi Steen          Delivered
Kim Steffensen       Delivered
Victor Stehmann      Delivered
Alan Steiner         Delivered
Jaka Stele           Delivered

Now, I know the results above are not correct, because I have read the message using OWA while logged on with at least one of those accounts. And in fact, we can check the read status for a single recipient, by appending the -RecipientFilterPath and -ReportTemplate parameters.

[PS] C:\>Get-MessageTrackingReport -Identity $msg.MessageTrackingReportId -BypassDelegateChecking -RecipientPathFilter jim.daly@contoso.com -ReportTemplate RecipientPath
RunspaceId              : 2dca05a6-56a9-4c0e-9c83-de6bc08bb5f0
MessageTrackingReportId : Message-Id=<b4699b83d1084712b2b746582ceedc15@contoso.com>,Server=ny-exch01.contoso.com,Intern
                          al-Id=0,Sender=1f67d9e7-982c-4b1e-878f-3e55f947b5e1,Domain=contoso.com
SubmittedDateTime       : 1/1/0001 12:00:00 AM
Subject                 :
FromAddress             :
FromDisplayName         :
RecipientAddresses      : {}
RecipientDisplayNames   :
DeliveredCount          : 0
PendingCount            : 0
UnsuccessfulCount       : 0
TransferredCount        : 0
RecipientTrackingEvents : {AllStaff@contoso.com,Submitted,,2016-06-09T06:31:01.0710000Z,
                          Jim.Daly@contoso.com,Expanded,,2016-06-09T06:31:02.2970000Z,Data=AllStaff@contoso.com;All
                          Staff, Jim.Daly@contoso.com,Delivered,,2016-06-09T06:31:10.1460000Z,
                          Jim.Daly@contoso.com,Read,,0001-01-01T00:00:00.0000000}
Identity                :
IsValid                 : True
ObjectState             : New

The recipient tracking events in that output show that Jim has read the message.

Now what about checking for all of the recipients? Well we can do that as well, by looping through the results with a bit of PowerShell. In my example, the variable $report already exists from when I ran Get-MessageTrackingReport earlier, so I can now run:

$recipienttrackingevents = @($report | Select -ExpandProperty RecipientTrackingEvents)
$recipients = $recipienttrackingevents | select recipientaddress
foreach ($recipient in $recipients) {
    $events = Get-MessageTrackingReport -Identity $msg.MessageTrackingReportId -BypassDelegateChecking `
    -RecipientPathFilter $recipient.RecipientAddress -ReportTemplate RecipientPath

    $events.RecipientTrackingEvents[-1] | Select RecipientAddress,Status,EventDescription
}

The output of those commands looks like this:

RecipientAddress                            Status EventDescription
----------------                            ------ ----------------
Apurva.Dalia@contoso.com                 Delivered Unread - The message is marked as Un...
Jim.Daly@contoso.com                     Delivered Read - The message is marked as Read...
Ryan.Danner@contoso.com                  Delivered Unread - The message is marked as Un...
Mike.Danseglio@contoso.com               Delivered Unread - The message is marked as Un...
Alex.Darrow@contoso.com                  Delivered Unread - The message is marked as Un...
Shannon.Dascher@contoso.com              Delivered Unread - The message is marked as Un...
WillsonRaj.David@contoso.com             Delivered Unread - The message is marked as Un...
Dan.Jump@contoso.com                     Delivered Unread - The message is marked as Un...
Michael.Jurek@contoso.com                Delivered Unread - The message is marked as Un...
Reto.Kch@contoso.com                     Delivered Unread - The message is marked as Un...
Dalibor.Kacmar@contoso.com               Delivered Unread - The message is marked as Un...
Wendy.Kahn@contoso.com                   Delivered Unread - The message is marked as Un...
Sandeep.Kaliyath@contoso.com             Delivered Unread - The message is marked as Un...
Mandar.Naik@contoso.com                  Delivered Unread - The message is marked as Un...
Ranjith.Narayanan@contoso.com            Delivered Unread - The message is marked as Un...
Mike.Nash@contoso.com                    Delivered Read - The message is marked as Read...
KirkJ.?Nason@contoso.com                 Delivered Unread - The message is marked as Un...
Mrina.Natarajan@contoso.com              Delivered Unread - The message is marked as Un...
Dave.Natsuhara@contoso.com               Delivered Unread - The message is marked as Un...
Mark.Steele@contoso.com                  Delivered Unread - The message is marked as Un...
Heidi.Steen@contoso.com                  Delivered Unread - The message is marked as Un...
Kim.Steffensen@contoso.com               Delivered Unread - The message is marked as Un...
Victor.Stehmann@contoso.com              Delivered Unread - The message is marked as Un...
Alan.Steiner@contoso.com                 Delivered Unread - The message is marked as Un...
Jaka.Stele@contoso.com                   Delivered Unread - The message is marked as Un...

Success! Sort of… even though I have the result, it’s not all that convenient. So let’s wrap it all up into a short script, called Get-MessageReadStatusReport.ps1 (GitHub). Here’s how it looks:

exchange-message-tracking-delivery-report-read-status

So there you are, tracking the read status of messages in your organization. This assumes that you’ve turned on read status tracking for the organization, and that it isn’t disabled for one or more of the mailboxes you’re interested. There’s a few other caveats as well:

  • Opening a message and actioning a message are two different things. Someone might open your message, but it doesn’t mean they’ve done what you want them to do (e.g. replied, clicked a link, filled out a form, etc)
  • Outlook and OWA mark messages read when they are selected. So read status doesn’t always mean a human has looked at the message.
  • An unread message sitting in the inbox, and an unread message that has been deleted, will be indistinguishable from each other when you look at delivery reports

This article Tracking Read Status of Email Messages in Exchange Server is © 2016 ExchangeServerPro.com

Get more Exchange Server tips at ExchangeServerPro.com

     

Viewing all articles
Browse latest Browse all 515

Trending Articles