classification
Title: SMTP_SSL doesn't use port 465 by default
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: kasun, pitrou, python-dev, sijinjoseph
Priority: normal Keywords: easy, patch

Created on 2011-04-26 16:48 by pitrou, last changed 2011-05-07 18:01 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
smtplib_default_ports.patch kasun, 2011-04-27 11:23 review
smtp_default_port_with_smtpnet_test.patch kasun, 2011-05-07 17:29 review
Messages (8)
msg134478 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-04-26 16:48
The SMTP_SSL doc says “If port is omitted, the standard SMTP-over-SSL port (465) is used”, but actually port 25 is used by default. The fix is trivial: make "default_port" a class attribute (in both SMTP and SMTP_SSL) instead of setting it inside the constructor.

test_smtpnet uses an explicit port to connect to gmail, which is why it doesn't exhibit the issue.

(Kasun, I'm adding you since you might be interested. Sorry if it isn't the case)
msg134551 - (view) Author: Kasun Herath (kasun) Date: 2011-04-27 11:23
I did a quick patch based on the suggested solution.

(pitrou, thanks for adding to the nosy list or could have missed this)
msg134563 - (view) Author: Sijin Joseph (sijinjoseph) Date: 2011-04-27 13:39
Should we add a unit test for this as well?
msg134941 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-01 23:05
> Should we add a unit test for this as well?

True, a simple test could be added to test_smtpnet.
msg135487 - (view) Author: Kasun Herath (kasun) Date: 2011-05-07 17:29
I'm submitting another patch which includes a test in test_smtpnet. Would appreciate further feedback.
msg135492 - (view) Author: Roundup Robot (python-dev) Date: 2011-05-07 17:48
New changeset 20e9d3e49689 by Antoine Pitrou in branch '3.1':
Issue #11927: SMTP_SSL now uses port 465 by default as documented.  Patch by Kasun Herath.
http://hg.python.org/cpython/rev/20e9d3e49689

New changeset 209744660b92 by Antoine Pitrou in branch '3.2':
Merge: Issue #11927: SMTP_SSL now uses port 465 by default as documented.
http://hg.python.org/cpython/rev/209744660b92

New changeset e708a57de190 by Antoine Pitrou in branch 'default':
Merge: Issue #11927: SMTP_SSL now uses port 465 by default as documented.
http://hg.python.org/cpython/rev/e708a57de190
msg135495 - (view) Author: Roundup Robot (python-dev) Date: 2011-05-07 17:59
New changeset bcf04ced5ef1 by Antoine Pitrou in branch '2.7':
Issue #11927: SMTP_SSL now uses port 465 by default as documented.  Patch by Kasun Herath.
http://hg.python.org/cpython/rev/bcf04ced5ef1
msg135496 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-07 18:01
The patch was committed in dev and maintenance branches. Thank you!
History
Date User Action Args
2011-05-07 18:01:35pitrousetstatus: open -> closed
resolution: fixed
messages: + msg135496

stage: needs patch -> resolved
2011-05-07 17:59:38python-devsetmessages: + msg135495
2011-05-07 17:48:51python-devsetnosy: + python-dev
messages: + msg135492
2011-05-07 17:29:05kasunsetfiles: + smtp_default_port_with_smtpnet_test.patch

messages: + msg135487
2011-05-01 23:05:38pitrousetmessages: + msg134941
2011-04-27 13:39:31sijinjosephsetnosy: + sijinjoseph
messages: + msg134563
2011-04-27 11:23:42kasunsetfiles: + smtplib_default_ports.patch
keywords: + patch
messages: + msg134551
2011-04-26 16:48:19pitroucreate