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 I've found this is not reliable.

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