Browse Source

set smtp server and port directly in the constructor of the SMTP class, only specifying it in the connect method causes issues with the tls connection in python 3.4

Helmut Pozimski 9 năm trước cách đây
mục cha
commit
1b4717d2db
2 tập tin đã thay đổi với 9 bổ sung7 xóa
  1. 6 0
      debian/changelog
  2. 3 7
      stov

+ 6 - 0
debian/changelog

@@ -1,3 +1,9 @@
+stov (0.9.3~beta3-1) unstable; urgency=low
+
+  * New upstream beta release
+
+ -- Helmut Pozimski <helmut@pozimski.eu>  Mon, 18 May 2015 21:23:00 +0200
+
 stov (0.9.3~beta2-1) unstable; urgency=low
 
   * New upstream beta release

+ 3 - 7
stov

@@ -512,14 +512,10 @@ elif OPTIONS.download is True:
             MAIL_TEXT += line + "\n"
         MSG_TEXT = MIMEText(MAIL_TEXT.encode("utf8"), _charset="utf8")
         MSG.attach(MSG_TEXT)
-        SERVER_CONNECTION = smtplib.SMTP()
+        SERVER_CONNECTION = smtplib.SMTP(CONF.values["mailhost"],
+                                         CONF.values["smtpport"])
         try:
-            if sys.version_info >= (3, 0):
-                SERVER_CONNECTION.connect(CONF.values["mailhost"],
-                                          CONF.values["smtpport"])
-            else:
-                SERVER_CONNECTION.connect(str(CONF.values["mailhost"]),
-                                          str(CONF.values["smtpport"]))
+            SERVER_CONNECTION.connect()
         except (smtplib.SMTPConnectError, smtplib.SMTPServerDisconnected,
                 socket.error):
             LOGGER.error(_("Could not connect to the smtp server, please check"