473,473 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to make smtplib.SMTP('localhost') work on window xp

Hi,
I am trying to use python module smtplib to send my email out on
window xp (localhost).

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

but I got the error information as follows:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "c:\python24\lib\smtplib.py", line 244, in __init__
(code, msg) = self.connect(host, port)
File "c:\python24\lib\smtplib.py", line 311, in connect
(code, msg) = self.getreply()
File "c:\python24\lib\smtplib.py", line 355, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed

I am not sure what is wrong with it. Should I configure my window xp
somewhere to run smtplib.SMTP('localhost')?

Thanks in advance.

ouyang
Sep 28 '08 #1
5 4659
In message
<56**********************************@p31g2000prf. googlegroups.com>, zxo102
wrote:
SMTPServerDisconnected: Connection unexpectedly closed
Does the SMTP server on localhost mention anything about the connection
attempt in its log?

If you telnet/netcat to port 25 on localhost, does anything interesting
happen?
Sep 29 '08 #2
On 9ÔÂ29ÈÕ, ÏÂÎç2ʱ53·Ö, Lawrence D'Oliveiro <l...@geek-
central.gen.new_zealandwrote:
In message
<56f2097a-5129-4d1a-be82-a73e2874b...@p31g2000prf.googlegroups.com>, zxo102
wrote:
SMTPServerDisconnected: Connection unexpectedly closed

Does the SMTP server on localhost mention anything about the connection
attempt in its log?

If you telnet/netcat to port 25 on localhost, does anything interesting
happen?
Thanks for your mentioning of the SMTP server on localhost. I did not
install that. After I install a free smtp server downloaded from
http://www.softstack.com/freesmtp.html,
and run the following python script again, everything is fine now.

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

Thanks for your message.

ouyang
Sep 29 '08 #3
zxo102 wrote:
Hi,
I am trying to use python module smtplib to send my email out on
window xp (localhost).

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

but I got the error information as follows:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "c:\python24\lib\smtplib.py", line 244, in __init__
(code, msg) = self.connect(host, port)
File "c:\python24\lib\smtplib.py", line 311, in connect
(code, msg) = self.getreply()
File "c:\python24\lib\smtplib.py", line 355, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed

I am not sure what is wrong with it. Should I configure my window xp
somewhere to run smtplib.SMTP('localhost')?

Thanks in advance.
Well your code certainly expects *something* to be listening on port 25
on localhost. It's fairly unusual to run an SMTP server on Windows XP,
though not impossible.

usually your email system is set up to use some external host as uts
SMPT server: if you look in your mail client's configuration you will
probably find out whihc host you should be using.

regards
Steve

--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 29 '08 #4
On 9ÔÂ29ÈÕ, ÏÂÎç7ʱ29·Ö, Steve Holden <st...@holdenweb.comwrote:
zxo102 wrote:
Hi,
I am trying to use python module smtplib to send my email out on
window xp (localhost).
import smtplib
server = smtplib.SMTP('localhost')
but I got the error information as follows:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "c:\python24\lib\smtplib.py", line 244, in __init__
(code, msg) = self.connect(host, port)
File "c:\python24\lib\smtplib.py", line 311, in connect
(code, msg) = self.getreply()
File "c:\python24\lib\smtplib.py", line 355, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed
I am not sure what is wrong with it. Should I configure my window xp
somewhere to run smtplib.SMTP('localhost')?
Thanks in advance.

Well your code certainly expects *something* to be listening on port 25
on localhost. It's fairly unusual to run an SMTP server on Windows XP,
though not impossible.

usually your email system is set up to use some external host as uts
SMPT server: if you look in your mail client's configuration you will
probably find out whihc host you should be using.

regards
Steve

--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
In my case, I implement an application with python to accomplish
collecting real time data from a serial port: com1 which is connected
to some xbee hardwares.
The python logging module is used to save the information generated at
runtime into a log file. Since the site is far away from my office, I
try to
use a smtp server with the python smtplib module to send the log file
into my email account regularly so that I can check it from anywhere.

Thanks for your suggestion.

Ouyang

Sep 29 '08 #5
zxo102 <zx****@gmail.comwrote:
>
In my case, I implement an application with python to accomplish
collecting real time data from a serial port: com1 which is connected
to some xbee hardwares.
The python logging module is used to save the information generated at
runtime into a log file. Since the site is far away from my office, I
try to
use a smtp server with the python smtplib module to send the log file
into my email account regularly so that I can check it from anywhere.
It's quite likely that the correct solution is for you to use the SMTP
server for the Internet provider at the remote site. When you run your own
SMTP server, it is WAY too easy to leave your configuration open for
spammers to abuse.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Oct 2 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Eric Osman | last post by:
Hi, When I run the following html file on netscape, and the button is clicked, the new window pops BEHIND all my other windows. How can I easily fix this html file so the window comes up in...
1
by: gat_ubela | last post by:
hello I have a web page but I don't have studies to make work a shopping cart ... I mean that I want to sell online but automatizied because by now I have to send quotations and that is a lot of...
3
by: Van_Gogh | last post by:
Hi, I am learning how to use the smtplib module, but am having some very early problems, maybe because I don't understand it. So, am I correct that by following the example in the Python: >>>...
2
by: kishkin | last post by:
Hello everybody! I just want to make window transparent. ;) At this moment I've found only ideas of taking screenshots to make background... Anything else? Thanks for help!
2
by: K B | last post by:
Hi, I'm using the following to send SMTP email from my localhost. I've ensured that the relay is allowed, etc. I have a Try Catch block. There is NO error thrown, no mail in...
5
by: universalbitmapper | last post by:
Hi, I'm trying to send an e-mail from a .php script and ie6 returns this error: Warning: mail() : Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port"...
3
by: Robert Dufour | last post by:
I've got code doing that that should work and I've tested doing that with a program called smtp diagnostics. In both cases if I use my outside e-mail provider account with login username and...
6
by: Howard Rifkin | last post by:
Hi, I my Javascript I popup an authentication window using the command; unamePasswdWindow = open("auth.html","","width=500,height=100"); This works fine in IE, and in Firefox 2.x on...
4
by: debadrita | last post by:
How to make a window page 100% using javascript or ajax , I want to make all pages height 100% in all resolution. I have small contents, so as I view this page in other resolutio I find this page...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.