Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
1b4717d2db
2 değiştirilmiş dosya ile 9 ekleme ve 7 silme
  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
 stov (0.9.3~beta2-1) unstable; urgency=low
 
 
   * New upstream beta release
   * New upstream beta release

+ 3 - 7
stov

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