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
This commit is contained in:
cvwillegen authored and Paulus Schoutsen committed 2019-01-16 09:56:53 -08:00
1 parent 9d112dc3f0
commit c8efbb2cdc
1 file changed
+2 -2
@@ -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())