newbie: raise socket.error, msg in smtplib
Gerhard Haering
gh at ghaering.de
Tue Apr 15 07:51:27 EDT 2003
Mark Carter wrote:
> I'm getting
>
> Traceback (most recent call last):
> File "C:\My Documents\myemail.py", line 26, in ?
> s.connect()
> File "C:\PYTHON22\lib\smtplib.py", line 283, in connect
> raise socket.error, msg
> error: (10061, 'Connection refused')
> [...]
> s = smtplib.SMTP()
smtplib.SMTP is defined similar to:
class SMTP:
def __init__(self, host="localhost", port=25)
[...]
So if you omit host and port, it tries to connect to the computer you're
running the program from (127.0.0.1, aka localhost on the default SMTP
port - 25).
It seems you're not running an SMTP server on your box, so just specify
a SMTP server you have access to.
-- Gerhard
More information about the Python-list
mailing list