[Tutor] Can Anyone help with SMTP processiing

Alan Gauld alan.gauld at btinternet.com
Sat Apr 17 17:44:05 CEST 2010

"Peter Meagher" <ppmeagher at gmail.com> wrote

> I'm a newbie with Python. Passable with other languages e.g.
> Basic, C++ and others.  
> Not a programmer per se, just trying to get work done that
> happens to require some programming skills and want to try
> my hand with Python.

Python is ideal for that.

> First time through, I got the prompts indicated in the code,
> except when I entered the ctrl Z nothing happened.
> The next time and subsequent times, thereafter I get the
> following 2 pop up message windows:
> IDLE Sub process Error
> Socket error: No connection could be made because the target
> machine actively refused it

> server = smtplib.SMTP('localhost')

My first question would be:
Does your local machine have an SMTP server running?
If it doesn't you won;t connect to it! You may need to use 
the SMTP server you use to send email

Also, I'd try something as long as this as a proper script 
rather than using IDLEs >>> prompt(if thats what you are doing.)
And then I'd run it from a DOS box to remove IDLE as a variable.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list