patchbomb: add TLS and SMTP AUTH support.
Original patch from Lee Cantey <lcantey@gmail.com>.
--- a/contrib/patchbomb Thu Sep 08 17:09:31 2005 -0700
+++ b/contrib/patchbomb Fri Sep 09 10:59:05 2005 -0700
@@ -35,6 +35,9 @@
# [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:
@@ -209,7 +212,14 @@
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)
parent = None
tz = time.strftime('%z')
for m in msgs: