From 8bcdd237c9c2f7812813198bfdad2f8800151d95 Mon Sep 17 00:00:00 2001 From: Martin Kofahl Date: Tue, 13 Mar 2018 13:04:46 +0100 Subject: [PATCH] Fix connecting _localhost_ by calling `connect()` on an already initialized smtplib object, introduced in 5ef60b331bf5495e557b6c1c48e5fad5893edeb7. According to the docs, `smtplib.SMTP()` calls the `connect` method for the given host. Calling `connect` again but without any parameters will fall back to smtplibs default, which is localhost:25. --- GeoHealthCheck/notifications.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/GeoHealthCheck/notifications.py b/GeoHealthCheck/notifications.py index 82547169..92fb63d1 100644 --- a/GeoHealthCheck/notifications.py +++ b/GeoHealthCheck/notifications.py @@ -102,8 +102,6 @@ def do_email(config, resource, run, status_changed, result): try: if config['GHC_SMTP']['tls']: server.starttls() - else: - server.connect() except Exception, err: LOGGER.exception("Cannot connect to smtp: %s[:%s]: %s", config['GHC_SMTP']['server'],