Message deletion in IMAP is a two step process: first delete, then expunge. Deleting a message just sets a flag that usually makes the mail client hide the message. It is the expunge that actually removes the message. Thus, exclude the deleted messages so that the unread count matches up with that of most mail clients.
This commit is contained in:
parent
de038bae65
commit
660e777f01
1 changed files with 1 additions and 1 deletions
|
@ -85,7 +85,7 @@ class ImapSensor(Entity):
|
|||
try:
|
||||
self.connection.select()
|
||||
self._unread_count = len(self.connection.search(
|
||||
None, 'UnSeen')[1][0].split())
|
||||
None, 'UnSeen UnDeleted')[1][0].split())
|
||||
except imaplib.IMAP4.error:
|
||||
_LOGGER.info("Connection to %s lost, attempting to reconnect",
|
||||
self._server)
|
||||
|
|
Loading…
Add table
Reference in a new issue