mercurial/mail.py
changeset 4096 49237d6ae97d
parent 3963 ba45041827a2
parent 4093 669f99f78db0
child 4483 a11e13d50645
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -6,7 +6,7 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 from i18n import _
-import os, smtplib, templater, util
+import os, smtplib, templater, util, socket
 
 def _smtp(ui):
     '''send mail using smtp.'''
@@ -21,6 +21,9 @@ def _smtp(ui):
             (mailhost, mailport))
     s.connect(host=mailhost, port=mailport)
     if ui.configbool('smtp', 'tls'):
+        if not hasattr(socket, 'ssl'):
+            raise util.Abort(_("can't use TLS: Python SSL support "
+                               "not installed"))
         ui.note(_('(using tls)\n'))
         s.ehlo()
         s.starttls()