Some private messages remain in privmsgs table, even though they have no ties in privmsgs_to anymore. For example my board reports 2,033 results with
SELECT `msg_id` FROM `phpbb_privmsgs` WHERE `msg_id` NOT IN (SELECT `msg_id` FROM `phpbb_privmsgs_to`)
All those messages are not accessible through any users UCP. I is not clear how it happened. As posted in the Support Forum under
such can happen, if a message from a deleted user is deleted. But this isn't necessarily the only way this can happen.
It isn't clear how this messages slipped through the deletion process. It seems however, that user_delete() from /includes/function_user.php might be responsible. It seems to delete messages from privmsgs that the deleted user send but that haven't been read by the recipient. However it is unclear if this includes unread messages that the recipient moved to other folders automatically via rules.
Also all privmsgs_to links to the user as recipient are deleted, but it seems it isn't checked whether or not this was the last link for that message (if the recipient(s) already deleted the messages).