Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is the error I have running a python program that sends a mail:

Traceback (most recent call last): 
File "D:/Share/Backup/DEV/2_tools/bbb_reports.py", line 116, in <module> 
File "D:/Share/Backup/DEV/2_tools/bbb_reports.py", line 108, in bbb_reports 
    send_mail(output, SENDER, RECIPIENTS) 
File "D:\Share\Backup\DEV\2_tools\pytools.py", line 83, in send_mail 
    s = smtplib.SMTP('notesgweur.michelin.com') 
File "C:\Python27\lib\smtplib.py", line 242, in __init__ 
    (code, msg) = self.connect(host, port) 
File "C:\Python27\lib\smtplib.py", line 302, in connect 
    self.sock = self._get_socket(host, port, self.timeout) 
File "C:\Python27\lib\smtplib.py", line 277, in _get_socket 
    return socket.create_connection((port, host), timeout) 
File "C:\Python27\lib\socket.py", line 571, in create_connection 
    raise err 
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it 

So I guess my port 25 is blocked on this machine (windows XP). I checked on another machine of the same domain, the program runs fine.

This is the same with telnet port 25: fails on this machine (Could not open connection to the host, on port 25: Connect failed), ok on the other one. I'd like to know if this comes from my machine (antivirus, firewall even if I checked it already...) or on the SMTP server itself, but I don't know what to check...

Thanks !

EDIT: Windows firewall is disabled, I even added my program (python.exe) and port 25 as explicitly allowed but no improvement. And when I compare the paths with tracert tool on the 2 machines, they are exactly the same...

share|improve this question
Try to disable Windows Firewall and see if anything changes... –  Mihai Todor Jul 30 '12 at 15:08
Are you connecting to localhost, or some other domain name for the smtp server? –  becomingwisest Jul 30 '12 at 15:53
Good point - I'm trying to connect to another server than localhost. –  Emmanuel Jul 30 '12 at 15:55
Make sure you aren't doing this from home. Many residential ISPs block outgoing connections to port 25 on any servers but their own. –  Michael Hampton Jul 30 '12 at 16:00
I'm at work, on an intranet so ISPs are not concerned here, hopefully ! :-) –  Emmanuel Jul 30 '12 at 16:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.