##// END OF EJS Templates
mail: unsupport smtp.verifycert (BC)...
Gregory Szorc -
r29285:63a37491 default
parent child Browse files
Show More
@@ -708,13 +708,7 b' def email(ui, repo, *revs, **opts):'
708 fp.close()
708 fp.close()
709 else:
709 else:
710 if not sendmail:
710 if not sendmail:
711 verifycert = ui.config('smtp', 'verifycert', 'strict')
711 sendmail = mail.connect(ui, mbox=mbox)
712 if opts.get('insecure'):
713 ui.setconfig('smtp', 'verifycert', 'loose', 'patchbomb')
714 try:
715 sendmail = mail.connect(ui, mbox=mbox)
716 finally:
717 ui.setconfig('smtp', 'verifycert', verifycert, 'patchbomb')
718 ui.status(_('sending '), subj, ' ...\n')
712 ui.status(_('sending '), subj, ' ...\n')
719 ui.progress(_('sending'), i, item=subj, total=len(msgs),
713 ui.progress(_('sending'), i, item=subj, total=len(msgs),
720 unit=_('emails'))
714 unit=_('emails'))
@@ -1486,16 +1486,6 b' Configuration for extensions that need t'
1486 Optional. Method to enable TLS when connecting to mail server: starttls,
1486 Optional. Method to enable TLS when connecting to mail server: starttls,
1487 smtps or none. (default: none)
1487 smtps or none. (default: none)
1488
1488
1489 ``verifycert``
1490 Optional. Verification for the certificate of mail server, when
1491 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1492 "strict" or "loose", the certificate is verified as same as the
1493 verification for HTTPS connections (see ``[hostfingerprints]`` and
1494 ``[web] cacerts`` also). For "strict", sending email is also
1495 aborted, if there is no configuration for mail server in
1496 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1497 :hg:`email` overwrites this as "loose". (default: strict)
1498
1499 ``username``
1489 ``username``
1500 Optional. User name for authenticating with the SMTP server.
1490 Optional. User name for authenticating with the SMTP server.
1501 (default: None)
1491 (default: None)
@@ -106,13 +106,6 b' def _smtp(ui):'
106 mailhost = ui.config('smtp', 'host')
106 mailhost = ui.config('smtp', 'host')
107 if not mailhost:
107 if not mailhost:
108 raise error.Abort(_('smtp.host not configured - cannot send mail'))
108 raise error.Abort(_('smtp.host not configured - cannot send mail'))
109 verifycert = ui.config('smtp', 'verifycert', 'strict')
110 if verifycert not in ['strict', 'loose']:
111 if util.parsebool(verifycert) is not False:
112 raise error.Abort(_('invalid smtp.verifycert configuration: %s')
113 % (verifycert))
114 verifycert = False
115
116 if smtps:
109 if smtps:
117 ui.note(_('(using smtps)\n'))
110 ui.note(_('(using smtps)\n'))
118 s = SMTPS(ui, local_hostname=local_hostname, host=mailhost)
111 s = SMTPS(ui, local_hostname=local_hostname, host=mailhost)
@@ -133,9 +126,9 b' def _smtp(ui):'
133 s.ehlo()
126 s.ehlo()
134 s.starttls()
127 s.starttls()
135 s.ehlo()
128 s.ehlo()
136 if (starttls or smtps) and verifycert:
129 if starttls or smtps:
137 ui.note(_('(verifying remote certificate)\n'))
130 ui.note(_('(verifying remote certificate)\n'))
138 sslutil.validatesocket(s.sock, verifycert == 'strict')
131 sslutil.validatesocket(s.sock)
139 username = ui.config('smtp', 'username')
132 username = ui.config('smtp', 'username')
140 password = ui.config('smtp', 'password')
133 password = ui.config('smtp', 'password')
141 if username and not password:
134 if username and not password:
General Comments 0
You need to be logged in to leave comments. Login now