diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-07 17:42:39 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-07 17:42:39 (GMT) |
commit | d7f12f30e48a599b41f03327321a75685f38ca0f (patch) | |
tree | ddfeb0a4cd913ccdca7481bef9dcdb9e7389acb9 /Lib | |
parent | 8b7664d0b81b65acf1e1946adf22d72cfa2dff26 (diff) | |
parent | 5bcc50c1b55527c18f91ca13d90d05a221b91a65 (diff) | |
download | cpython-d7f12f30e48a599b41f03327321a75685f38ca0f.zip cpython-d7f12f30e48a599b41f03327321a75685f38ca0f.tar.gz cpython-d7f12f30e48a599b41f03327321a75685f38ca0f.tar.bz2 |
Merge: Issue #11927: SMTP_SSL now uses port 465 by default as documented.
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/smtplib.py | 6 | ||||
-rw-r--r-- | Lib/test/test_smtpnet.py | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 213138c..15294ff 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -231,6 +231,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): @@ -246,7 +247,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: @@ -817,13 +817,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 f0f1edd..0198ab6 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): + support.get_attribute(smtplib, 'SMTP_SSL') + with support.transient_internet(self.testServer): + server = smtplib.SMTP_SSL(self.testServer) + server.ehlo() + server.quit() + def test_main(): support.run_unittest(SmtpSSLTest) |