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 years ago
parent
commit
1b4717d2db
2 changed files with 9 additions and 7 deletions
  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"