SMTP [SSL] unknown error since 2024.5.x

Running as Docker container (2024.5.5). Notify SMTP used to work fine for me prior to upgrading from 2024.4 to 2024.5. Now I’m running into a [SSL] unknown error.

Below a simple python script that runs just fine inside the same container, so why isn’t working from Home Assistant?

My config:

notify:
	- name: "mail_me"
	  platform: smtp
	  server: "mail.infomaniak.com"
	  port: 465
	  encryption: tls
	  sender: "MY@USER"
	  recipient: "MY@USER"
	  username: "MY@USER"
	  password: "MY PASSWORD"

The error:

2024-05-25T16:45:57.869395737Z 2024-05-25 18:45:57.863 INFO (MainThread) [homeassistant.components.notify] Setting up notify.smtp
2024-05-25T16:45:58.074324484Z 2024-05-25 18:45:58.023 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
2024-05-25T16:45:58.074596725Z Traceback (most recent call last):
2024-05-25T16:45:58.074720880Z   File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 104, in async_setup_platform
2024-05-25T16:45:58.074845467Z     notify_service = await hass.async_add_executor_job(
2024-05-25T16:45:58.074950213Z                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.075037329Z   File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
2024-05-25T16:45:58.075150872Z     result = self.fn(*self.args, **self.kwargs)
2024-05-25T16:45:58.075376424Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.075476907Z   File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 103, in get_service
2024-05-25T16:45:58.075587367Z     if mail_service.connection_is_valid():
2024-05-25T16:45:58.075680193Z        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.075764140Z   File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 165, in connection_is_valid
2024-05-25T16:45:58.075868702Z     server = self.connect()
2024-05-25T16:45:58.075959644Z              ^^^^^^^^^^^^^^
2024-05-25T16:45:58.076040058Z   File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 144, in connect
2024-05-25T16:45:58.076142721Z     mail = smtplib.SMTP_SSL(
2024-05-25T16:45:58.076314197Z            ^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.076455133Z   File "/usr/local/lib/python3.12/smtplib.py", line 1022, in __init__
2024-05-25T16:45:58.076648251Z     SMTP.__init__(self, host, port, local_hostname, timeout,
2024-05-25T16:45:58.076795348Z   File "/usr/local/lib/python3.12/smtplib.py", line 255, in __init__
2024-05-25T16:45:58.076904974Z     (code, msg) = self.connect(host, port)
2024-05-25T16:45:58.077004453Z                   ^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.077088129Z   File "/usr/local/lib/python3.12/smtplib.py", line 341, in connect
2024-05-25T16:45:58.077241516Z     self.sock = self._get_socket(host, port, self.timeout)
2024-05-25T16:45:58.077426886Z                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.077595422Z   File "/usr/local/lib/python3.12/smtplib.py", line 1029, in _get_socket
2024-05-25T16:45:58.077729967Z     new_socket = self.context.wrap_socket(new_socket,
2024-05-25T16:45:58.077830879Z                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.077915724Z   File "/usr/local/lib/python3.12/ssl.py", line 455, in wrap_socket
2024-05-25T16:45:58.078017046Z     return self.sslsocket_class._create(
2024-05-25T16:45:58.078113545Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-25T16:45:58.078254488Z   File "/usr/local/lib/python3.12/ssl.py", line 1042, in _create
2024-05-25T16:45:58.078440121Z     self.do_handshake()
2024-05-25T16:45:58.078558822Z   File "/usr/local/lib/python3.12/ssl.py", line 1320, in do_handshake
2024-05-25T16:45:58.078663350Z     self._sslobj.do_handshake()
2024-05-25T16:45:58.078824887Z ssl.SSLError: [SSL] unknown error (_ssl.c:1000)

This python script runs perfectly fine inside the same container:

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

usr = 'MY@USER'

msg = MIMEMultipart()
msg['From'] = usr
msg['To'] = usr
msg['Subject'] = 'simple email in python'
message = 'body'
msg.attach(MIMEText(message))

with smtplib.SMTP_SSL('mail.infomaniak.com',465) as mail_server:
    mail_server.ehlo()
    mail_server.login(usr, 'MY PASSWORD')
    mail_server.sendmail(usr, usr, msg.as_string())

Waze Travel Time?! Whenever I enable this integration, SMTP stops working.

SMTP starts working again after removing Waze and restarting. Reproduced in default new docker container as well.

My mind is blown.

Created an issue: Waze Travel Time conflicting with SMTP · Issue #118654 · home-assistant/core · GitHub