mercurial/mail.py
changeset 4093 669f99f78db0
parent 2964 26c8d37496c2
child 4096 49237d6ae97d
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -7,7 +7,7 @@
 
 from i18n import gettext as _
 from demandload import *
-demandload(globals(), "os re smtplib templater util")
+demandload(globals(), "os re smtplib templater util socket")
 
 def _smtp(ui):
     '''send mail using smtp.'''
@@ -22,6 +22,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()