I am trying to write a Python script to send an email from my server, now from my research the first thing I see is I have to set server = smtplib.SMTP('server?', 25)
and were server
? is Im not sure what to put I have seen smtp.gmail.com
and I have seen localhost
, Ideally I want send the email form my Gmail account so I think I want smtp.gmail.com
but when I have that I get this error
Traceback (most recent call last):
File "/home/jam/public_html/cgi-bin/email.py", line 6, in <module>
server = smtplib.SMTP('smtp.gmail.com', 25)
File "/usr/lib64/python2.6/smtplib.py", line 239, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib64/python2.6/smtplib.py", line 295, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib64/python2.6/smtplib.py", line 273, in _get_socket
return socket.create_connection((port, host), timeout)
File "/usr/lib64/python2.6/socket.py", line 567, in create_connection
raise error, msg
socket.error: [Errno 101] Network is unreachable
So what is supposed to go there?
Thanks for the help :)