New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
smtplib.py initialisation defect #48552
Labels
Comments
smtplib does not initialise the valriable 'sock' in the case where Eg: % python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import smtplib
>>> client=smtplib.SMTP('')
>>> client.sendmail('from@home', 'to@home', 'test')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/smtplib.py", line 676, in sendmail
if not (200 <= self.ehlo()[0] <= 299):
File "/usr/lib/python2.5/smtplib.py", line 397, in ehlo
self.putcmd("ehlo", name or self.local_hostname)
File "/usr/lib/python2.5/smtplib.py", line 333, in putcmd
self.send(str)
File "/usr/lib/python2.5/smtplib.py", line 318, in send
if self.sock:
AttributeError: SMTP instance has no attribute 'sock'
>>> The fix is to add "self.sock = None" in __init__ if host is not set, % python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import smtplib
>>> client=smtplib.SMTP('')
>>> client.sendmail('from@home', 'to@home', 'test')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/smtplib.py", line 678, in sendmail
if not (200 <= self.ehlo()[0] <= 299):
File "/usr/lib/python2.5/smtplib.py", line 399, in ehlo
self.putcmd("ehlo", name or self.local_hostname)
File "/usr/lib/python2.5/smtplib.py", line 335, in putcmd
self.send(str)
File "/usr/lib/python2.5/smtplib.py", line 327, in send
raise SMTPServerDisconnected('please run connect() first')
smtplib.SMTPServerDisconnected: please run connect() first
>>> |
piers
mannequin
added
stdlib
Python modules in the Lib dir
type-bug
An unexpected behavior, bug, or error
labels
Nov 12, 2008
This issue can be fixed by backporting r60975. |
Backporting is fine with me: any volunteers? |
I will backport this. |
Done. Fixed in r67686 (release25-maint). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
0 participants
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: