[hotfix] comply with imap and pop auth failed response (#2712)

* [hotfix] comply with imap and pop auth failed response

* simplified hotfix for imap and pop auth response
This commit is contained in:
robert schouten 2017-02-27 14:39:46 +08:00 committed by Rushabh Mehta
parent 9aad1c52c4
commit 2b3f5db9da

View file

@ -123,7 +123,9 @@ class EmailAccount(Document):
try:
email_server.connect()
except (error_proto, imaplib.IMAP4.error), e:
if in_receive and ("authentication failed" in e.message.lower() or "log in via your web browser" in e.message.lower()):
message = e.message.lower().replace(" ","")
if in_receive and any(map(lambda t: t in message, ['authenticationfail', 'loginviayourwebbrowser', #abbreviated to work with both failure and failed
'loginfailed', 'err[auth]', 'errtemporaryerror'])): #temporary error to deal with godaddy
# if called via self.receive and it leads to authentication error, disable incoming
# and send email to system manager
self.handle_incoming_connect_error(