How does Messagestats determine which mailboxes appear in the "Inactive Mailboxes" report?
The algorithm for the Mailbox Inactivity report is to look for at least one activity statistic record for the time frame specified. If one is found, then the mailbox is considered active and not part of the report. If one is not found, then the mailbox is considered inactive.
This algorithm does have one caveat in that if a mailbox does not have any activity statistics records for a given day (i.e. the tracking log on that day is not processed, for whatever reason), that mailbox is considered inactive for that day.
An activity statistics record is a record of message submission and message delivery that is found by parsing the Exchange tracking logs.
MessageStats is a product that aggregates information and stores the resultant aggregated information into the database. This aggregated information is associated to a given day. This is done for performance reasons, as tracking logs exist for each GMT day. One of these elements that is aggregated is the activity of a given mailbox. The aggregated information is the number of messages that were sent and received by a mailbox. This information is shown in the Mailbox Activity report. In addition to the storage of normal activity, an additional aggregated value is also computed. That is the Last Mail Sent and the Last Mail Received. These are re-calculated if the given mailbox sent any messages (or received for the Last Mail Received) for the Last Mail Sent.
For the report, Inactive Mailboxes by No Messages Sent, the idea is to provide a list of mailboxes that did not have any messages sent during the user defined time frame. In essence, it looks for at least one activity record with a Number of Messages count being greater than zero for a given day (as described above). If at least one is found, the mailbox is considered Active and is not included in the report.
Since the report looks for the existence of a particular data and discards its inclusion in the report if certain data is there, there is the caveat that if there are no records for a given user (due to no tracking logs processed for a particular server on a particular day), then the report will not see activity on that day for that mailbox and consider inactive for that day. If the report spans multiple days, the report first checks each day within the time period selected and then finalizes the aggregation.
So given this, it is possible to have a Last Mail Sent be a certain day, but the mailbox will show up in the given report. The idea of messages received by a mailbox and the associated Last Mail Received value are not used in the Inactive Mailbox report. If the Last Mail Sent occurs after the data range, a mailbox could show up in the Inactive Mailbox report.