smtplib (111, 'Connection refused')

J

Josh Close

I'm using the smtplib module and I keep getting this error: (111,
'Connection refused') What could be causing this? I've tried it from a
different computer and it seems to work, but not from this specific
server. If port 25 was blocked for some reason, would that give me a
'connection refused' error?

-Josh
 
C

Chris Green

Josh Close said:
I'm using the smtplib module and I keep getting this error: (111,
'Connection refused') What could be causing this? I've tried it from a
different computer and it seems to work, but not from this specific
server. If port 25 was blocked for some reason, would that give me a
'connection refused' error?

Yes. When in doubt, try telnet <host> <port>.
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Josh said:
I'm using the smtplib module and I keep getting this error: (111,
'Connection refused') What could be causing this?

This means there is no SMTP server running on the remote system.
However, there *is* a TCP implementation (typically the operating
system) on the other end that tells you port 25 is not being
listened to.

Regards,
Martin
 
J

Josh Close

Does smtplib even use a smtp server? I looked at the source and it
looks like it just connects via a socket and sends like that.

-Josh
 
D

Donn Cave

Josh Close said:
Does smtplib even use a smtp server? I looked at the source and it
looks like it just connects via a socket and sends like that.

That's what SMTP is, the protocol to be used on that socket.
Your program is an SMTP client. Where is the SMTP server?

Donn Cave, (e-mail address removed)
 
P

phansen

Josh said:
I'm using the smtplib module and I keep getting this error: (111,
'Connection refused') What could be causing this? I've tried it from a
different computer and it seems to work, but not from this specific
server. If port 25 was blocked for some reason, would that give me a
'connection refused' error?

Please show a snippet of the code you are using, so we can
see what you are trying to do here.
 
J

Josh Close

import smtplib

mail = smtplib.SMTP('localhost')
mail.send('me','(e-mail address removed)','message goes here')
mail.quit()

but this fails at the smtplib.SMTP() line on one box, but not on another.

-Josh
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Josh said:
import smtplib

mail = smtplib.SMTP('localhost')
mail.send('me','(e-mail address removed)','message goes here')
mail.quit()

but this fails at the smtplib.SMTP() line on one box, but not on another.

OK, so you have an SMTP server on one box but not another. Either
install an SMTP server on another box, or connect to "one box" on
both boxes, instead of connecting to "localhost" on either.

Regards,
Martin
 
T

Tim Williams

----- Original Message -----
import smtplib

mail = smtplib.SMTP('localhost')
mail.send('me','(e-mail address removed)','message goes here')
mail.quit()

but this fails at the smtplib.SMTP() line on one box, but not on another.

You either only have an SMTP server running on one box (the successful one),
or localhost isn't configured properly on the failing machine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top