Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: sending of mail (smtp) - connection refused - but smtp serveris running!

Thread Tools

RE: sending of mail (smtp) - connection refused - but smtp serveris running!

Raaijmakers, Vincent \(GE Infrastructure\)
Posts: n/a
run a "netstat -an' on the server and look for what ip address port 25 is open. Perhaps it is on (localhost) instead of


-----Original Message-----
From: python-list-bounces+vincent.raaijmakers=(E-Mail Removed)
[mailtoython-list-bounces+vincent.raaijmakers=(E-Mail Removed)]On
Behalf Of Alex Hunsley
Sent: Tuesday, June 29, 2004 10:27 AM
To: Removed)
Subject: sending of mail (smtp) - connection refused - but smtp server
is running!

I am using the smtp module to send emails via a local SMTP server on our network.
I am failing with "connection refused" error, even though we definitely have an
smtp server running on port 25!

the code is like this:

me = '(E-Mail Removed)'
you = '(E-Mail Removed)'
msg['Subject'] = '*** alert'
msg['From'] = me
msg['To'] = you

s = smtplib.SMTP('')
s.sendmail(me, [you], msg.as_string())

print "Email sent."

When I run this code, I get:

Traceback (most recent call last):
File "C:\Python23\", line 58, in -toplevel-
File "C:\Python23\lib\", line 302, in connect
raise socket.error, msg
error: (10061, 'Connection refused')

here's me verifying that SMTP server is indeed alive at port 25 on my local

$ telnet 25
Connected to
Escape character is '^]'.
220 ESMTP Server FTGate

any ideas what the problem could be? this usually happens when someone is not
aware they have to run an SMTP server, but we do have one running, as can be
seen above!



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
smtp error: unable to connect to remote server...No connection could be made because the target machine actively refused it Homer ASP .Net 2 08-13-2007 05:39 PM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... Java 0 09-28-2006 06:38 AM
Sending SMTP mail when SMTP server is unavailable Java 3 01-24-2006 06:53 PM
connection refused using smtp matamoscas Java 4 09-07-2005 01:05 PM
sending of mail (smtp) - connection refused - but smtp server isrunning! Alex Hunsley Python 4 06-29-2004 04:30 PM