diff --git a/src/certificate.py b/src/certificate.py index 0fca3bf07..577048777 100644 --- a/src/certificate.py +++ b/src/certificate.py @@ -455,11 +455,15 @@ investigate : -- Certificate Manager """ - import smtplib - - smtp = smtplib.SMTP("localhost") - smtp.sendmail(from_, [to_], message.encode("utf-8")) - smtp.quit() + try: + import smtplib + smtp = smtplib.SMTP("localhost") + smtp.sendmail(from_, [to_], message.encode("utf-8")) + 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):