SF.net SVN: tmda: [2165] trunk/tmda

[email protected] Thu, 01 Mar 2007 12:32:46 -0800
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2165
          http://svn.sourceforge.net/tmda/?rev=2165&view=rev
Author:   jasonrm
Date:     2007-03-01 12:32:46 -0800 (Thu, 01 Mar 2007)

Log Message:
-----------
Bugfix in SMTP mode that allows TLS and SMTP AUTH to be used together. TLS has 
to come first, before AUTH, or else you'd get this kind of error:

smtplib.SMTPException: SMTP AUTH extension not supported by server.

Modified Paths:
--------------
    trunk/tmda/NEWS
    trunk/tmda/TMDA/ChangeLog
    trunk/tmda/TMDA/SMTP.py

Modified: trunk/tmda/NEWS
===================================================================
--- trunk/tmda/NEWS	2007-03-01 01:42:55 UTC (rev 2164)
+++ trunk/tmda/NEWS	2007-03-01 20:32:46 UTC (rev 2165)
@@ -14,6 +14,9 @@
   feature. For more information, see tmda-ofmipd's '--help' output or
   the "SSL/TLS" section of http://wiki.tmda.net/TmdaOfmipdHowto
 
+* Fixed a minor bug that prevented the use of both SMTPSSL and
+  SMTPAUTH together.
+
 ======================================================================
 
 TMDA 1.1.11 "Ladyburn" --

Modified: trunk/tmda/TMDA/ChangeLog
===================================================================
--- trunk/tmda/TMDA/ChangeLog	2007-03-01 01:42:55 UTC (rev 2164)
+++ trunk/tmda/TMDA/ChangeLog	2007-03-01 20:32:46 UTC (rev 2165)
@@ -1,3 +1,8 @@
+2007-03-01  Jason R. Mastaler  <[email protected]>
+
+	* SMTP.py (Connection.__connect): bugfix: TLS must come before
+	SMTP AUTH or else you won't be able to use both of them together.
+
 2007-02-23  Jason R. Mastaler  <[email protected]>
 
 	* Util.py (format_timeout): Use Defaults.TIMEOUT_UNITS.

Modified: trunk/tmda/TMDA/SMTP.py
===================================================================
--- trunk/tmda/TMDA/SMTP.py	2007-03-01 01:42:55 UTC (rev 2164)
+++ trunk/tmda/TMDA/SMTP.py	2007-03-01 20:32:46 UTC (rev 2165)
@@ -45,14 +45,14 @@
         self.__conn = smtplib.SMTP()
         self.__conn.connect(Defaults.SMTPHOST)
         self.__numsessions = Defaults.SMTP_MAX_SESSIONS_PER_CONNECTION
+        # Optional TLS (SSL) mode.
+        if Defaults.SMTPSSL:
+            self.__conn.starttls(Defaults.SMTPSSL_KEYFILE,
+                                 Defaults.SMTPSSL_CERTFILE)
         # Optional SMTP Authentication.
         if Defaults.SMTPAUTH_USERNAME and Defaults.SMTPAUTH_PASSWORD:
             self.__conn.login(Defaults.SMTPAUTH_USERNAME,
                               Defaults.SMTPAUTH_PASSWORD)
-        # Optional TLS (SSL) mode.
-        if Defaults.SMTPSSL:
-            self.__conn.starttls(Defaults.SMTPSSL_KEYFILE,
-                                 Defaults.SMTPSSL_CERTFILE)
             
     def sendmail(self, envsender, recips, msgtext):
         if self.__conn is None:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.