[Checkins] SVN: zope.sendmail/branches/ajung-encryption-branch/src/zope/sendmail/mailer.py added suport for new no_tls, force_tls flags

Andreas Jung andreas at andreas-jung.com
Sat Aug 18 12:55:36 EDT 2007


Log message for revision 78957:
  added suport for new no_tls, force_tls flags
  

Changed:
  U   zope.sendmail/branches/ajung-encryption-branch/src/zope/sendmail/mailer.py

-=-
Modified: zope.sendmail/branches/ajung-encryption-branch/src/zope/sendmail/mailer.py
===================================================================
--- zope.sendmail/branches/ajung-encryption-branch/src/zope/sendmail/mailer.py	2007-08-18 16:45:50 UTC (rev 78956)
+++ zope.sendmail/branches/ajung-encryption-branch/src/zope/sendmail/mailer.py	2007-08-18 16:55:36 UTC (rev 78957)
@@ -54,7 +54,11 @@
                                 '(code=%s, response=%s)' % (code, response))
 
         # encryption support
-        if connection.has_extn('starttls') and have_ssl:
+        have_tls =  connection.has_extn('starttls') 
+        if not have_tls and self.force_tls:
+            raise MailHostError('TLS is not available but TLS is required')
+
+        if have_tls and have_ssl and not self.no_tls: 
             connection.starttls()
             connection.ehlo()
 



More information about the Checkins mailing list