Fix link to documentation link, select read-only (#20155)

- Fixed link to documentation page at the top of the sensor
- Select the IMAP4 Inbox read-only so that reading e-mail does not mark messages as Read
pull/20160/head^2
cvwillegen 2019-01-16 18:56:53 +01:00 committed by Paulus Schoutsen
parent 9d112dc3f0
commit c8efbb2cdc
1 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@
Email sensor support. Email sensor support.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.email/ https://home-assistant.io/components/sensor.imap_email_content/
""" """
import logging import logging
import datetime import datetime
@ -97,7 +97,7 @@ class EmailReader:
"""Read the next email from the email server.""" """Read the next email from the email server."""
import imaplib import imaplib
try: try:
self.connection.select() self.connection.select('Inbox', readonly=True)
if not self._unread_ids: if not self._unread_ids:
search = "SINCE {0:%d-%b-%Y}".format(datetime.date.today()) search = "SINCE {0:%d-%b-%Y}".format(datetime.date.today())