0

I am trying to set up a temporary SMTP server to send an email. I am using python for this (smtplib.SMTP('localhost')) and getting a socket error. When I try wget localhost, I get a "failed: Connection refused" error. /etc/hosts has 127.0.0.1 localhost. I am using chrubuntu, and don't believe I have done anything that would modify localhost.

4
  • you might use smtpd instead of smtplib
    – dagrha
    Nov 26, 2014 at 0:00
  • Firstly, I'm using code slightly modified from the python docs for howto send an email. Secondly, I don't see how that explains why wget and links reveal nothing, when I think they should say something exists. Nov 26, 2014 at 0:13
  • wget would only indicate presence or absence of a webserver (not a mailserver) surely? AFAIK smtplib implements a client - the sample program appears to assume you already have an SMTP server running on localhost. Nov 26, 2014 at 1:50
  • Question does not make sense: you don't "create" localhost; your machine is the localhost. wget says the connection is refused because you aren't running a web server.
    – psusi
    Nov 26, 2014 at 2:20

1 Answer 1

0

Your problem is that you want to use the SMTP service on your local computer and this service does not exist!

So, ou need to install the SMTP daemon

apt-get install opensmtpd

then, you need to start it using

sudo smtpd

and now, your command should work.

Not the answer you're looking for? Browse other questions tagged .