[Python-bugs-list] smtplib - some bugs in code and documentation too(?!) (PR#357)
Fred L. Drake, Jr.
Thu, 15 Jun 2000 10:25:18 -0400 (EDT)
> 1. SMTP object work different then you wrote in documentation
The example in the documentation has been corrected in the sources;
this will be released with the Python 1.6 documentation. If you find
other errors in the documentation, I'd like to know about them in a
new bug report.
> 2. default port is 0 (SMTP() constructor) I think that 25 is
> better number.
If a false value is used, the value of smtplib.SMTP_PORT is used
instead. The use of a false value replaced with the real value is
fairly conventional throughout Python libraries, and is a matter of
> 3.default hostname in constructor is ''. I think that
> 'localhost' is better choice
The use of '' in the constructor is used to determine whether the
connection should be built automatically or delayed until the user
calls the connect() method. Calling connect() without specifying the
host does use 'localhost'.
> 4. def connect(self, host='localhost', port = 0). You replace
> parameters from constructor! ( def __init__(self,
> host = '', port = 0)!) Is it good idea?
These default values are only used when the constructor does not
call connect(); the constructor provides all parameters when it does
> OK, you want connect to localhost and port 0?
> No. :-(
See my comment to issue 2 above; the proper port number is used.
> > server.set_debuglevel(1)
> > server.connect()
> You connect to localhost to port 0. It is not good
> idea. ;-)
Connecting twice doesn't work either; this bug in the example has
been corrected in the sources by removing the unnecessary call to
I'm going to reclassify this bug report as "resolved" (since there
really was a documentation bug that's been fixed); if you feel this is
not correct, please submit a new bug report.
Thanks for your attention to detail!
Fred L. Drake, Jr. <fdrake at beopen.com>
BeOpen PythonLabs Team Member