Sendmail Errno[61] Connection Refused

If you start a local server as follows:

python -m smtpd -n -c DebuggingServer localhost:1025

Make sure to modify the mail-sending code to use the non-standard port number:

server = smtplib.SMTP(SERVER, 1025)
server.sendmail(FROM, TO, message)
server.quit()

My guess is that you do not have any SMTP server installed on your local machine.

If your emails are not sensitive, open a Gmail account and send your emails using it with Python.


Start a simple SMTP server with Python like so:

python -m smtpd -n -c DebuggingServer localhost:1025