Log if mail connection fails
This commit is contained in:
parent
0ea85ff307
commit
ffa76d7822
1 changed files with 7 additions and 3 deletions
|
@ -46,9 +46,13 @@ def configure_and_validate_mailer(config, logger):
|
|||
config.get(ConfigParameter.SMTP_LOGIN),
|
||||
config.get(ConfigParameter.SMTP_PASSWORD),
|
||||
)
|
||||
mailer.configure_destination(config.get(ConfigParameter.SITE_ADMIN_EMAIL))
|
||||
if not mailer.check():
|
||||
logger.error("Email configuration not working")
|
||||
mailer.configure_destination(config.get(ConfigParameter.SITE_ADMIN_EMAIL))
|
||||
try:
|
||||
if not mailer.check():
|
||||
logger.error("Email configuration not working")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
logging.error("Failed to check email: %s", e)
|
||||
sys.exit(1)
|
||||
return mailer
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue