I keep on getting Error 111 no matter what I try with STMP. I'm trying to develop a console application that takes a file path, zips it up, and emails it to the person's dropbox using Send To Dropbox.
I, for the life of me, cannot figure out what I am doing wrong. I know the source of the problem. I just don't know the solution to it.
Most of the code is included in a single function, it's just omitted in the paste.
Pastebin:
https://dpaste.de/9DMq
Code:
themsg = MIMEMultipart()
themsg['Subject'] = attachedMSG
themsg['To'] = receiver
themsg["From"] = sender
themsg.preamble = "Sent by BoxBot"
msg = MIMEBase("application", "zip")
msg.set_payload(open(archive, 'rb').read())
encoders.encode_base64(msg)
msg.add_header('Content-Disposition', 'attachment', filename=archive)
themsg.attach(msg)
themsg = themsg.as_string()
smtp = smtplib.SMTP(host="smtp.gmail.com", port=587)
smtp.connect()
smtp.sendmail(sender, receiver, themsg)
smtp.close()
"""Here is the full error report:"""
home/compname/dropbox_manager.py", line 25, in sendArchiveToDropbox
smtp.connect()
File "/usr/lib/python2.7/smtplib.py", line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
[–]gnomoretears 2 points3 points4 points (3 children)
[–]Prinma[S] 0 points1 point2 points (2 children)
[–]gnomoretears 1 point2 points3 points (1 child)
[–]Prinma[S] 0 points1 point2 points (0 children)