Do not fail smtp notify service on connection error (#27240)

* smtp notify dont disable service

* auth fails smtp notify service
This commit is contained in:
Brendon Baumgartner 2019-10-08 01:14:17 -07:00 committed by Martin Hjelmare
parent 50b5dba43e
commit 15870e0185

View File

@ -136,16 +136,15 @@ class MailNotificationService(BaseNotificationService):
server = None
try:
server = self.connect()
except smtplib.socket.gaierror:
except (smtplib.socket.gaierror, ConnectionRefusedError):
_LOGGER.exception(
"SMTP server not found (%s:%s). "
"Please check the IP address or hostname of your SMTP server",
"SMTP server not found or refused connection (%s:%s). "
"Please check the IP address, hostname, and availability of your SMTP server.",
self._server,
self._port,
)
return False
except (smtplib.SMTPAuthenticationError, ConnectionRefusedError):
except smtplib.SMTPAuthenticationError:
_LOGGER.exception(
"Login not possible. "
"Please check your setting and/or your credentials"