diff --git a/imapnotify/core.py b/imapnotify/core.py index 720f5ee..f44d1bd 100644 --- a/imapnotify/core.py +++ b/imapnotify/core.py @@ -131,7 +131,13 @@ async def _select_box(self, box='INBOX'): self.boxes[box]['idle'] = asyncio.ensure_future(imap_client.idle()) def _is_new_msg(self, msg): - return 'EXISTS' in msg + if 'EXISTS' in msg: + return True + + # if msg is list of messages + for x in msg: + if 'EXISTS' in x: + return True async def _on_new_message(self, box): command = self.boxes[box]['on_new_message']