Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/mail.py @ 4093:669f99f78db0
mail.py: don't try to use TLS if python doesn't have SSL support
This should hide the traceback from issue501.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 16 Feb 2007 04:54:47 -0200 |
parents | 26c8d37496c2 |
children | 49237d6ae97d |
comparison
equal
deleted
inserted
replaced
4092:4ced663bebf0 | 4093:669f99f78db0 |
---|---|
5 # This software may be used and distributed according to the terms | 5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. | 6 # of the GNU General Public License, incorporated herein by reference. |
7 | 7 |
8 from i18n import gettext as _ | 8 from i18n import gettext as _ |
9 from demandload import * | 9 from demandload import * |
10 demandload(globals(), "os re smtplib templater util") | 10 demandload(globals(), "os re smtplib templater util socket") |
11 | 11 |
12 def _smtp(ui): | 12 def _smtp(ui): |
13 '''send mail using smtp.''' | 13 '''send mail using smtp.''' |
14 | 14 |
15 local_hostname = ui.config('smtp', 'local_hostname') | 15 local_hostname = ui.config('smtp', 'local_hostname') |
20 mailport = int(ui.config('smtp', 'port', 25)) | 20 mailport = int(ui.config('smtp', 'port', 25)) |
21 ui.note(_('sending mail: smtp host %s, port %s\n') % | 21 ui.note(_('sending mail: smtp host %s, port %s\n') % |
22 (mailhost, mailport)) | 22 (mailhost, mailport)) |
23 s.connect(host=mailhost, port=mailport) | 23 s.connect(host=mailhost, port=mailport) |
24 if ui.configbool('smtp', 'tls'): | 24 if ui.configbool('smtp', 'tls'): |
25 if not hasattr(socket, 'ssl'): | |
26 raise util.Abort(_("can't use TLS: Python SSL support " | |
27 "not installed")) | |
25 ui.note(_('(using tls)\n')) | 28 ui.note(_('(using tls)\n')) |
26 s.ehlo() | 29 s.ehlo() |
27 s.starttls() | 30 s.starttls() |
28 s.ehlo() | 31 s.ehlo() |
29 username = ui.config('smtp', 'username') | 32 username = ui.config('smtp', 'username') |