Fix unread emails helper for cached deliveries

When delivery method is set to cache, the helper method to find unread
messages in a mailbox can fail to correctly identify the read messages,
because it expects the same ruby objects in the cached deliveries array
and the read messages collection, but this is not reliable because
serializing and de-serializing messages will create new ruby objects.

This commit updates the code to use message ids when subtracting the
collection of read messages from the mailbox to find unread messages.