Pyton smtp connection time out

Pyton smtp connection time out

I'm trying to send email from my server. I'm trying to send forgot password/ welcome emails from my python web server.

---

import smtplib from email.mime.text import MIMEText # Define to/from sender = 'sender@example.com' recipient = 'recipient@example.com' # Create message msg = MIMEText("Message text") msg['Subject'] = "Sent from python" msg['From'] = sender msg['To'] = recipient # Create server object with SSL option server = smtplib.SMTP_SSL('smtp.zoho.com', 465) # Perform operations via server server.login('sender@example.com', 'password') server.sendmail(sender, [recipient], msg.as_string()) server.quit()

---

I get this error.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/smtplib.py", line 776, in __init__
    SMTP.__init__(self, host, port, local_hostname, timeout)
  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 781, in _get_socket
    new_socket = socket.create_connection((host, port), timeout)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
socket.error: [Errno 110] Connection timed out