changeset 1226:f3837564ed03

patchbomb: add TLS and SMTP AUTH support. Original patch from Lee Cantey <lcantey@gmail.com>.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 09 Sep 2005 10:59:05 -0700
parents ea90162e210c
children e3ea354d99b2
files contrib/patchbomb
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: