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.
1 Answer
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.
smtpd
instead ofsmtplib
wget
would only indicate presence or absence of a webserver (not a mailserver) surely? AFAIKsmtplib
implements a client - the sample program appears to assume you already have an SMTP server running onlocalhost
.wget
says the connection is refused because you aren't running a web server.