diff mercurial/mail.py @ 19050:601c1e226889

smtp: use 465 as default port for SMTPS Before this patch, port 25 (wellknown port of SMTP) is used as default port, even if "[smtp] tls" is configured as "smtps". This patch uses port 465 (wellknown port of SMTPS) as default port, if "[smtp] tls" is configured as "smtps".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 19 Apr 2013 01:26:23 +0900
parents 6edb0e18b83c
children 53f16f4aff33
line wrap: on
line diff
--- a/mercurial/mail.py	Thu Feb 21 21:05:06 2013 +0000
+++ b/mercurial/mail.py	Fri Apr 19 01:26:23 2013 +0900
@@ -111,7 +111,11 @@
         s = STARTTLS(sslkwargs, local_hostname=local_hostname)
     else:
         s = smtplib.SMTP(local_hostname=local_hostname)
-    mailport = util.getport(ui.config('smtp', 'port', 25))
+    if smtps:
+        defaultport = 465
+    else:
+        defaultport = 25
+    mailport = util.getport(ui.config('smtp', 'port', defaultport))
     ui.note(_('sending mail: smtp host %s, port %s\n') %
             (mailhost, mailport))
     s.connect(host=mailhost, port=mailport)