[Tutor] Sending Email

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Fri, 27 Sep 2002 21:49:40 -0700 (PDT)


On Fri, 27 Sep 2002, Glen Barnett wrote:

> >>> import smtplib
> >>> s=smtplib.SMTP("localhost")
> Traceback (most recent call last):
>   File "<pyshell#2>", line 1, in ?
>     s=smtplib.SMTP("localhost")
>   File "C:\PYTHON22\lib\smtplib.py", line 234, in __init__
>     (code, msg) = self.connect(host, port)
>   File "C:\PYTHON22\lib\smtplib.py", line 283, in connect
>     raise socket.error, msg
> error: (10061, 'Connection refused')
> >>>
>
> I'm connected to my ISP while I try it. Is there something else I need
> to use for the host?

Hi Glen,

On your line here:

> >>> s=smtplib.SMTP("localhost")


that address there should be that of your SMTP mail server --- it probably
shouldn't be 'localhost' because that's refering to your computer, not the
ISP's computer.

Check your email setup, and you should be able to find something that
refers to your ISP's SMTP server.  Once you've set this to the appropriate
server, you shouldn't get that error message anymore.


Hope this helps!