Error trying to set up smtp

Trying to set up smtp to be able to send mails to myself through HA.

config is as follows (with sensitive data changed to example.com):

  - name: summary_mail
    platform: smtp
    server: smtp.example.com
    port: 587
    timeout: 15
    sender: [email protected]
    encryption: tls
    username: my_smtp_username
    password: !secret summary_mail_password
    recipient:
      - [email protected]
    sender_name: SkyHome Summary

Log is as follows:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 78, in async_setup_platform
    platform.get_service, hass, p_config, discovery_info
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 84, in get_service
    if mail_service.connection_is_valid():
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 138, in connection_is_valid
    server = self.connect()
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 122, in connect
    mail = smtplib.SMTP_SSL(self._server, self._port, timeout=self._timeout)
  File "/usr/local/lib/python3.7/smtplib.py", line 1031, in __init__
    source_address)
  File "/usr/local/lib/python3.7/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.7/smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/local/lib/python3.7/smtplib.py", line 1039, in _get_socket
    server_hostname=self._host)
  File "/usr/local/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/usr/local/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)

Any ideas what could be the cause of this? I have the same smtp account imported in my gmail and there it works, so credentials, server etc should be good to go.

Found it, needed to use starttls instead of tls