Mercurial > hg > pyhgsh
comparison contrib/patchbomb @ 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 | b0f6053df539 |
children | 5352a5407dc1 |
comparison
equal
deleted
inserted
replaced
1225:ea90162e210c | 1226:f3837564ed03 |
---|---|
33 # hgrc file: | 33 # hgrc file: |
34 # | 34 # |
35 # [smtp] | 35 # [smtp] |
36 # host = my_mail_host | 36 # host = my_mail_host |
37 # port = 1025 | 37 # port = 1025 |
38 # tls = yes # or omit if not needed | |
39 # username = user # if SMTP authentication required | |
40 # password = password # if SMTP authentication required - PLAINTEXT | |
38 # | 41 # |
39 # To configure other defaults, add a section like this to your hgrc | 42 # To configure other defaults, add a section like this to your hgrc |
40 # file: | 43 # file: |
41 # | 44 # |
42 # [patchbomb] | 45 # [patchbomb] |
207 | 210 |
208 if not opts['test']: | 211 if not opts['test']: |
209 s = smtplib.SMTP() | 212 s = smtplib.SMTP() |
210 s.connect(host = ui.config('smtp', 'host', 'mail'), | 213 s.connect(host = ui.config('smtp', 'host', 'mail'), |
211 port = int(ui.config('smtp', 'port', 25))) | 214 port = int(ui.config('smtp', 'port', 25))) |
212 | 215 if ui.configbool('smtp', 'tls'): |
216 s.ehlo() | |
217 s.starttls() | |
218 s.ehlo() | |
219 username = ui.config('smtp', 'username') | |
220 password = ui.config('smtp', 'password') | |
221 if username and password: | |
222 s.login(username, password) | |
213 parent = None | 223 parent = None |
214 tz = time.strftime('%z') | 224 tz = time.strftime('%z') |
215 for m in msgs: | 225 for m in msgs: |
216 try: | 226 try: |
217 m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) | 227 m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) |