瀏覽代碼

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 年之前
父節點
當前提交
1b4717d2db
共有 2 個文件被更改,包括 9 次插入7 次删除
  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"