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_LOGIN),
|
||||||
config.get(ConfigParameter.SMTP_PASSWORD),
|
config.get(ConfigParameter.SMTP_PASSWORD),
|
||||||
)
|
)
|
||||||
mailer.configure_destination(config.get(ConfigParameter.SITE_ADMIN_EMAIL))
|
mailer.configure_destination(config.get(ConfigParameter.SITE_ADMIN_EMAIL))
|
||||||
if not mailer.check():
|
try:
|
||||||
logger.error("Email configuration not working")
|
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)
|
sys.exit(1)
|
||||||
return mailer
|
return mailer
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue