Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions homeassistant/components/imap_email_content/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def _fetch_message(self, message_uid):

if message_data is None:
return None
if message_data[0] is None:
Comment thread
MartinHjelmare marked this conversation as resolved.
return None
raw_email = message_data[0][1]
email_message = email.message_from_bytes(raw_email)
return email_message
Expand All @@ -126,6 +128,8 @@ def read_next(self):
self._last_id = int(message_uid)
return self._fetch_message(message_uid)

return self._fetch_message(str(self._last_id))

except imaplib.IMAP4.error:
_LOGGER.info("Connection to %s lost, attempting to reconnect", self._server)
try:
Expand Down