Help! SMTPlib

Andrew Henshaw andrew.henshaw at gtri.gatech.edu
Sat May 27 02:21:47 EDT 2000


sjoshi at ingr.com wrote:
>Hello
> I'm trying to use the smtplib for sending mail, and I keep getting
>error: (10061, 'winsock error') when I try just to connect to the
>localhost.
>

I'm guessing that your code looks something like:

  import smtplib

  server=smtplib.SMTP('localhost')
  server.connect()


If so, then your problem is that the server.connect() function was already
called when you instantiated "server".   The connection is automatically made
when you provide the hostname as a parameter to SMTP.

I believe that the SMTP example in the library documentation is in error, in
this regard.

Andrew Henshaw



More information about the Python-list mailing list