SOCKET ERROR: [Errno 111] Connection refused
python, python-2.7, smtp, sockets
Solution
Start a simple SMTP server with Python like so:
python -m smtpd -n -c DebuggingServer localhost:1025
or you can also try gmail smtp setting
server = smtplib.SMTP(host='smtp.gmail.com', port=587)
Problem
I am using simple python lib for the SMTP But i am getting this error: ``` import smtplib smtpObj = smtplib.SMTP('localhost') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/smtplib.py", line 249, in __init__ (code, msg) = self.connect(host, port) File "/usr/lib/python2.7/smtplib.py", line 309, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/lib/python2.7/smtplib.py", line 284, in _get_socket return socket.create_connection((port, host), timeout) File "/usr/lib/python2.7/socket.py", line 571, in create_connection raise err socket.error: [Errno 111] Connection refused ``` Using python-2.7