summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-05-07 19:59:33 +0200
committerAntoine Pitrou <solipsis@pitrou.net>2011-05-07 19:59:33 +0200
commit1823ad7451885e88a8e44b14975e6e54f131b9d1 (patch)
treeb9c98a8eb0fd035aba637058a7aaa56ba468512c
parentda62936f29d98c1d88e7ba589122d0e3fcf0fdc9 (diff)
downloadcpython-1823ad7451885e88a8e44b14975e6e54f131b9d1.tar.gz
Issue #11927: SMTP_SSL now uses port 465 by default as documented. Patch by Kasun Herath.
-rwxr-xr-xLib/smtplib.py6
-rw-r--r--Lib/test/test_smtpnet.py7
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
4 files changed, 15 insertions, 2 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index e7d3786229..e3ffb37be3 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -222,6 +222,7 @@ class SMTP:
ehlo_msg = "ehlo"
ehlo_resp = None
does_esmtp = 0
+ default_port = SMTP_PORT
def __init__(self, host='', port=0, local_hostname=None,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
@@ -237,7 +238,6 @@ class SMTP:
"""
self.timeout = timeout
self.esmtp_features = {}
- self.default_port = SMTP_PORT
if host:
(code, msg) = self.connect(host, port)
if code != 220:
@@ -756,13 +756,15 @@ if _have_ssl:
are also optional - they can contain a PEM formatted private key and
certificate chain file for the SSL connection.
"""
+
+ default_port = SMTP_SSL_PORT
+
def __init__(self, host='', port=0, local_hostname=None,
keyfile=None, certfile=None,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
self.keyfile = keyfile
self.certfile = certfile
SMTP.__init__(self, host, port, local_hostname, timeout)
- self.default_port = SMTP_SSL_PORT
def _get_socket(self, host, port, timeout):
if self.debuglevel > 0:
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py
index f25343d27f..2dc39eb8f7 100644
--- a/Lib/test/test_smtpnet.py
+++ b/Lib/test/test_smtpnet.py
@@ -17,6 +17,13 @@ class SmtpSSLTest(unittest.TestCase):
server.ehlo()
server.quit()
+ def test_connect_default_port(self):
+ test_support.get_attribute(smtplib, 'SMTP_SSL')
+ with test_support.transient_internet(self.testServer):
+ server = smtplib.SMTP_SSL(self.testServer)
+ server.ehlo()
+ server.quit()
+
def test_main():
test_support.run_unittest(SmtpSSLTest)
diff --git a/Misc/ACKS b/Misc/ACKS
index 3c0e370735..9b9ff68523 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -337,6 +337,7 @@ Malte Helmert
Lance Finn Helsten
Jonathan Hendry
James Henstridge
+Kasun Herath
Chris Herborth
Ivan Herman
Jürgen Hermann
diff --git a/Misc/NEWS b/Misc/NEWS
index 8f3c0b9ab1..36d0080694 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,9 @@ Core and Builtins
Library
-------
+- Issue #11927: SMTP_SSL now uses port 465 by default as documented. Patch
+ by Kasun Herath.
+
- Issue 11999: fixed sporadic sync failure mailbox.Maildir due to its trying to
detect mtime changes by comparing to the system clock instead of to the
previous value of the mtime.