Closed namn closed 13 years ago
Since the debug level needs to be set prior to a connection being made, marrow.mailer's smtp transport should not supply arguments to the SMTP connection's initialization handler that would cause it to connect. Explicit is better than implicit.
Additionally, improper handling of internal file handles in the Python smtp package is a bug in Python; an additional bug report should be filed there.
Python docs says:
Therefore,
connect_to_server
makes an extra call toSMTP.connect
. This is not only needless but wrong also. Deep within smtplib,SMTP.file
is only created ingetreply
. Andgetreply
is called inconnect
. Another call toconnect
, hence, will create another socket, butgetreply
always refers to the oldfile
(socket).It is debatable whether this is smtplib or marrow.mailer.transport.smtp though. I would like to see smtplib's
connect
refresh itsfile
as well assock
variables. But an easier fix, one that you have control over, is to fix smtp transport ;).