Added better logging for case when IMAP folder may not exist when check IMAP messages, to address issue in #536

This commit is contained in:
Garret Wassermann 2017-09-13 01:44:36 -04:00
parent 5846732ef1
commit 96cae9bdd5

View File

@ -195,7 +195,10 @@ def process_queue(q, logger):
settings.QUEUE_EMAIL_BOX_PASSWORD)
server.select(q.email_box_imap_folder)
status, data = server.search(None, 'NOT', 'DELETED')
try:
status, data = server.search(None, 'NOT', 'DELETED')
except imaplib.IMAP4.error:
logger.error("IMAP retrieve failed. Is the folder '%s' spelled correctly, and does it exist on the server?" % q.email_box_imap_folder)
if data:
msgnums = data[0].split()
logger.info("Received %d messages from IMAP server" % len(msgnums))