certificate: be more resilient when mail cant be sent to root for some reason ..

This commit is contained in:
Alexandre Aubin 2022-12-21 20:43:30 +01:00
parent 94e3c7b756
commit d7ee1c23f3

View file

@ -455,11 +455,15 @@ investigate :
-- Certificate Manager -- Certificate Manager
""" """
import smtplib try:
import smtplib
smtp = smtplib.SMTP("localhost") smtp = smtplib.SMTP("localhost")
smtp.sendmail(from_, [to_], message.encode("utf-8")) smtp.sendmail(from_, [to_], message.encode("utf-8"))
smtp.quit() smtp.quit()
except Exception as e:
# Dont miserably crash the whole auto renew cert when one renewal fails ...
# cf boring cases like https://github.com/YunoHost/issues/issues/2102
logger.exception(f"Failed to send mail about cert renewal failure ... : {e}")
def _check_acme_challenge_configuration(domain): def _check_acme_challenge_configuration(domain):