SMTP notification stopped working

Hi folks,

long time ago, my notification by email stopped working. I have had a lot other more important things to do so I ignored it a while, but now want to resolve it. I have checked all parameters and all should be fine, I even tested it using a testing tool to send SMTP mails on my Windows laptop and it worked fine with the same parameters. Still, since (meanwhile) many new versions of HA, the service does not start.

Logger: homeassistant.components.notify
Source: components/smtp/notify.py:152
Integration: Benachrichtigung (documentation, issues)
First occurred: 22:17:26 (1 occurrences)
Last logged: 22:17:26

Error setting up platform smtp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 93, in async_setup_platform
    notify_service = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 100, in get_service
    if mail_service.connection_is_valid():
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 162, in connection_is_valid
    server = self.connect()
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 152, in connect
    mail.starttls(context=ssl_context)
  File "/usr/local/lib/python3.10/smtplib.py", line 790, in starttls
    self.sock = context.wrap_socket(self.sock,
  File "/usr/local/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.10/ssl.py", line 1071, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.10/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)

My configuration looks fine, though, as said:

notify:
# eMail notification
  - name: email
    platform: smtp
    server: mail.server.net
    port: 587
    timeout: 25
    sender: <mymailaddress>
    encryption: starttls
    username: !secret email_jochen_username
    password: !secret email_jochen_password
    recipient:
      - <recipientmailaddress>
    sender_name: Home Assistant

What could be wrong and how could I try to fix it? any ideas? Could it be the server´s certificate? But this (and has always been) a Let´sEncrypt and i´ve double-checked it, it is valid and contains the hostnames I tried in the Subject Alternative Names. The webUI to my mail system states no certificate error…

Any help appreciated, I am lost actually

… as usual, some moments after posting, I found the solution myself. I had to add

verify_ssl: False

(see also: Smtp failed to set up because of certificate failure - #21 by nickrout)

1 Like