Help with smtp notification (timeout error)

I’m trying to configure the smtp to send a notification, but when starting I get a timeout error

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/bootstrap.py", line 106, in _setup_component
    result = component.setup(hass, config)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/notify/__init__.py", line 85, in setup
    notify_service = notify_implementation.get_service(hass, p_config)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/notify/smtp.py", line 60, in get_service
    if mail_service.connection_is_valid():
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/notify/smtp.py", line 100, in connection_is_valid
    server = self.connect()
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/notify/smtp.py", line 86, in connect
    mail = smtplib.SMTP(self._server, self._port, timeout=5)
  File "/usr/lib/python3.5/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python3.5/smtplib.py", line 337, in connect
    (code, msg) = self.getreply()
  File "/usr/lib/python3.5/smtplib.py", line 390, in getreply
    + str(e))
smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out

Anybody have any ideas?

Is your smtp reachable? Or if there is firewall blocking the outgoing traffic?
I am using smtp from gmail. Here is my working configuration:

- platform: smtp
  name: <name>
  port: 587
  recipient: <name>@gmail.com
  sender: <name>@gmail.com
  server: smtp.gmail.com
  starttls: true
  username: <name>@gmail.com
  password: !secret smtp_password
  debug: true

Heh, you put less information here than on reddit. I’ll repeat myself:

It seems a connection to server.com:465 cannot be made from that system.
Is that the right server? The right port? Can you get there from the command line? Does that port support STARTTLS (which is not the same as SSL)?

465 is usually SSL (ie connection starts encrypted), not STARTTLS (ie connection is made unencrypted then is upgraded). STARTTLS is usually on 587 (or 25). I’m not sure HASS supports legacy SMTPS.

Also, is it actually server.com or is it smtp.server.com or mail.server.com?

It is reachable by my mail client. I did play with my settings, and was able to replicate the problem with thunderbird by switching the connection security from SSL/TLS to STARTTLS. So is there a way to use SSL in the SMTP component?