diff --git a/sendmail.py b/sendmail.py index 38b4b24..992ff1a 100755 --- a/sendmail.py +++ b/sendmail.py @@ -30,9 +30,9 @@ class Mailer(object): self.s = smtplib.SMTP(config["mail"]["mailserver"]) try: context = ssl.create_default_context() + self.s.starttls(context=context) except: - logger.error('Creating SSL Context failed.', exc_info=True) - self.s.starttls(context=context) + logger.error('StartTLS failed.', exc_info=True) self.s.login(config["mail"]["user"], config["mail"]["passphrase"]) def send(self, text, recipient, subject, attachment=None):