From 3acfc416bf6f7f546365f04653b6c3cc9373b511 Mon Sep 17 00:00:00 2001 From: slidingshade Date: Thu, 9 Apr 2020 17:34:42 +0300 Subject: [PATCH] Fix for smtp-servers using SSL Fix for smtp-servers using SSL, works with gmail.com, yandex.ru and other public servers with ssl. Variant with smtplib.SMTP doesn't work with smtp.yandex.ru (popular public mail provider in Russia, something like google, but local) returning "SMTPServerDisconnected: Connection unexpectedly closed" error, same with gmail. Seems like SSL is everywhere nowdays, so should work most modern smtp servers. --- wallabag_kindle_consumer/sender.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wallabag_kindle_consumer/sender.py b/wallabag_kindle_consumer/sender.py index eca3f19..6b96854 100644 --- a/wallabag_kindle_consumer/sender.py +++ b/wallabag_kindle_consumer/sender.py @@ -37,8 +37,7 @@ class Sender: msg.attach(mobi) - smtp = smtplib.SMTP(host=self.host, port=self.port) - smtp.starttls() + smtp = smtplib.SMTP_SSL(host=self.host, port=self.port) if self.user is not None: smtp.login(self.user, self.passwd) smtp.sendmail(self.from_addr, [email], msg.as_string())