[admin update 2013-10-28: see the wiki section on email/smtp]
I used to be able to use smtplib to send emails with my program, but it's not connecting to the network anymore. This is the basic code
import smtplib
user = mygmail@gmail.com
password = mypassword
smtpserv="smtp.gmail.com:587"
mailserver=smtplib.SMTP(smtpserv)
mailserver.starttls()
mailserver.login(user,password)
mailserver.sendmail(user,tolist,message)
pythonanywhere breaks it at the mailserver=smtplib.SMTP(smtpserv). This works fine on my computer
This is the error I get:
>>> mailserver = smtplib.SMTP(smtpserv)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.3/smtplib.py", line 238, in __init__
(code, msg) = self.connect(host, port)
File "/usr/local/lib/python3.3/smtplib.py", line 317, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/local/lib/python3.3/smtplib.py", line 288, in _get_socket
self.source_address)
File "/usr/local/lib/python3.3/socket.py", line 424, in create_connection
raise err
File "/usr/local/lib/python3.3/socket.py", line 415, in create_connection
sock.connect(sa)
OSError: [Errno 101] Network is unreachable