Commit 99391d7f authored by Leo Pound Singer's avatar Leo Pound Singer

Add log messages to email client

parent 7e0ddf9a
......@@ -40,19 +40,29 @@ class Receiver(EmailBootStep):
username, _, password = netrc().authenticators(self._host)
while self._running:
try:'Starting new connection')
with IMAPClient(self._host, use_uid=True, timeout=30) as conn:'Logging in')
conn.login(username, password)'Selecting inbox')
while self._running:'Searching for new messages')
messages ='Fetching new messages')
for msgid, data in conn.fetch(
messages, ['RFC822']).items():'Sending signal for new email')
email_received.send(None, rfc822=data[b'RFC822'])'Deleting email')
conn.delete_messages(msgid)'Starting idle')
responses = []
while self._running and not responses:'Checking idle')
responses = conn.idle_check(timeout=5)'Idle done')
except IMAPClientAbortError:
log.exception('IMAP connection aborted')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment