Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 2200:9f43b6e24232
move mail sending code into core, so extensions can share it.
document hgrc settings used.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Thu, 04 May 2006 12:23:01 -0700 |
parents | 564034552f7f |
children | f15056b29472 |
line wrap: on
line diff
--- a/hgext/patchbomb.py Thu May 04 12:02:32 2006 -0700 +++ b/hgext/patchbomb.py Thu May 04 12:23:01 2006 -0700 @@ -31,16 +31,6 @@ # the messages directly. This can be reviewed e.g. with "mutt -R -f mbox", # and finally sent with "formail -s sendmail -bm -t < mbox". # -# To configure a default mail host, add a section like this to your -# hgrc file: -# -# [smtp] -# host = my_mail_host -# port = 1025 -# tls = yes # or omit if not needed -# username = user # if SMTP authentication required -# password = password # if SMTP authentication required - PLAINTEXT -# # To configure other defaults, add a section like this to your hgrc # file: # @@ -52,7 +42,7 @@ from mercurial.demandload import * demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils mercurial:commands,hg,ui - os errno popen2 smtplib socket sys tempfile time''') + os errno popen2 socket sys tempfile time''') from mercurial.i18n import gettext as _ try: @@ -225,17 +215,7 @@ ui.write('\n') if not opts['test'] and not opts['mbox']: - s = smtplib.SMTP() - s.connect(host = ui.config('smtp', 'host', 'mail'), - port = int(ui.config('smtp', 'port', 25))) - if ui.configbool('smtp', 'tls'): - s.ehlo() - s.starttls() - s.ehlo() - username = ui.config('smtp', 'username') - password = ui.config('smtp', 'password') - if username and password: - s.login(username, password) + mail = ui.sendmail() parent = None tz = time.strftime('%z') sender_addr = email.Utils.parseaddr(sender)[1] @@ -273,9 +253,9 @@ fp.close() else: ui.status('Sending ', m['Subject'], ' ...\n') - s.sendmail(sender, to + cc, m.as_string(0)) + mail.sendmail(sender, to + cc, m.as_string(0)) if not opts['test'] and not opts['mbox']: - s.close() + mail.close() cmdtable = { 'email':