From 15870e0185fef1c0a97d1d342e30dcc015bef2ac Mon Sep 17 00:00:00 2001 From: Brendon Baumgartner Date: Tue, 8 Oct 2019 01:14:17 -0700 Subject: [PATCH] Do not fail smtp notify service on connection error (#27240) * smtp notify dont disable service * auth fails smtp notify service --- homeassistant/components/smtp/notify.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/smtp/notify.py b/homeassistant/components/smtp/notify.py index 8a96865ab8d..d592f25a61d 100644 --- a/homeassistant/components/smtp/notify.py +++ b/homeassistant/components/smtp/notify.py @@ -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"