Yahoo SMTP

Josiah Carlson jcarlson at uci.edu
Sun Oct 17 20:12:28 EDT 2004


>     >>> import smtplib
>     >>> smtplib.SMTP.debuglevel = 1
>     >>> smtplib.SMTP('foo.bar')
>     connect: ('foo.bar', 25)
> 
>   Connecting to TCP port 0 makes no sense, so that would be a silly default behavior.

Ahh, I just noticed the SMTP_PORT reference in SMTP.connect()

Regardless, doing a secondary connect() call without arguments just
connects locally...

>>> smtplib.SMTP.debuglevel = 1
>>> a = smtplib.SMTP('smtp.mail.yahoo.com')
connect: ('smtp.mail.yahoo.com', 25)
connect: ('smtp.mail.yahoo.com', 25)
reply: '220 smtp011.mail.yahoo.com ESMTP\r\n'
reply: retcode (220); Msg: smtp011.mail.yahoo.com ESMTP
connect: smtp011.mail.yahoo.com ESMTP
>>> a.connect()
connect: ('localhost', 25)
connect: ('localhost', 25)
connect fail: ('localhost', 25)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "f:\apps\python23\lib\smtplib.py", line 302, in connect
    raise socket.error, msg
socket.error: (10061, 'Connection refused')


So the port 25 isn't necessary, but the secondary connect the original
poster used, kills his connection.

 - Josiah




More information about the Python-list mailing list