comparison mercurial/mail.py @ 4096:49237d6ae97d

merge with crew-stable
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 16 Feb 2007 05:27:37 -0200
parents ba45041827a2 669f99f78db0
children a11e13d50645
comparison
equal deleted inserted replaced
4085:719488a98ebe 4096:49237d6ae97d
4 # 4 #
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 _ 8 from i18n import _
9 import os, smtplib, templater, util 9 import os, smtplib, templater, util, socket
10 10
11 def _smtp(ui): 11 def _smtp(ui):
12 '''send mail using smtp.''' 12 '''send mail using smtp.'''
13 13
14 local_hostname = ui.config('smtp', 'local_hostname') 14 local_hostname = ui.config('smtp', 'local_hostname')
19 mailport = int(ui.config('smtp', 'port', 25)) 19 mailport = int(ui.config('smtp', 'port', 25))
20 ui.note(_('sending mail: smtp host %s, port %s\n') % 20 ui.note(_('sending mail: smtp host %s, port %s\n') %
21 (mailhost, mailport)) 21 (mailhost, mailport))
22 s.connect(host=mailhost, port=mailport) 22 s.connect(host=mailhost, port=mailport)
23 if ui.configbool('smtp', 'tls'): 23 if ui.configbool('smtp', 'tls'):
24 if not hasattr(socket, 'ssl'):
25 raise util.Abort(_("can't use TLS: Python SSL support "
26 "not installed"))
24 ui.note(_('(using tls)\n')) 27 ui.note(_('(using tls)\n'))
25 s.ehlo() 28 s.ehlo()
26 s.starttls() 29 s.starttls()
27 s.ehlo() 30 s.ehlo()
28 username = ui.config('smtp', 'username') 31 username = ui.config('smtp', 'username')