I was having issues with the Pi so I put a new image of Jessie on it. I reloaded a python script that has been running for a year and a half that sends a email. Now when it tries to send the email I get these errors. Does anyone know what might have changed that is causing this?
File "GarageDoor3.py", line 111, in <module> sendEmail(name) File "GarageDoor3.py", line 35, in sendEmail mail=smtplib.SMTP('smtp.gmail.com',587) File "/usr/lib/python3.4/smtplib.py", line 242, in __init__ (code, msg) = self.connect(host, port) File "/usr/lib/python3.4/smtplib.py", line 321, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/lib/python3.4/smtplib.py", line 292, in _get_socket self.source_address) File "/usr/lib/python3.4/socket.py", line 491, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "/usr/lib/python3.4/socket.py", line 530, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known
My code is:
def sendEmail(subject): content=(subject + ' is opened') mail=smtplib.SMTP('smtp.gmail.com',587) mail.ehlo() mail.starttls() mail.login('xxxx','notrealpassword') mail.sendmail('firstname.lastname@example.org','email@example.com',content)