Skip to content

Commit

Permalink
Add a debug traceback log on account connection tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Jun 7, 2020
1 parent f57a50e commit 218f04f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kanmail/server/views/accounts_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import traceback

from flask import jsonify, request
from imapclient import imapclient

from kanmail.log import logger
from kanmail.server.app import app
from kanmail.server.mail import Account
from kanmail.server.mail.autoconf import get_autoconf_settings
Expand Down Expand Up @@ -65,13 +68,17 @@ def _test_account_settings(account_settings, get_folders=False):
if get_folders:
folders = _get_folders(connection)
except Exception as e:
trace = traceback.format_exc().strip()
logger.debug(f'IMAP connection exception traceback: {trace}')
return False, ('imap', f'{e}')

# Check SMTP
try:
with new_account.get_smtp_connection() as connection:
pass
except Exception as e:
trace = traceback.format_exc().strip()
logger.debug(f'SMTP connection exception traceback: {trace}')
return False, ('smtp', f'{e}')

if get_folders:
Expand Down

0 comments on commit 218f04f

Please sign in to comment.