[New-bugs-announce] [issue8245] email examples don't actually work (SMTP.connect is not called)

Jason R. Coombs report at bugs.python.org
Sat Mar 27 19:20:48 CET 2010


New submission from Jason R. Coombs <jaraco at jaraco.com>:

Documentation for Python 2.6.5 and 3.1.2 both describe using the smtplib as so:

    s = smtplib.SMTP()
    s.sendmail(me, [you], msg.as_string())
    s.quit()

However, this sample usage is incorrect and doesn't work in practice, because s.connect() is never called. If the reader copies the example code, he will get an error on the call to sendmail:

    smtplib.SMTPServerDisconnected: please run connect() first

The documentation should be updated to reflect the requisite s.connect() call (or to supply sample host/port parameters in the construction).

It appears that in the 2.3.5 docs, the .connect() call was there. I have not yet investigated why it was removed.

----------
assignee: georg.brandl
components: Documentation, Library (Lib)
messages: 101833
nosy: georg.brandl, jaraco
severity: normal
status: open
title: email examples don't actually work (SMTP.connect is not called)
versions: Python 2.6, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8245>
_______________________________________


More information about the New-bugs-announce mailing list