SMTP not working and SMTP integration not available

Make sure to generate an app password if you are using Gmail and have MFA turned on.
https://support.google.com/mail/answer/185833?hl=en-GB

Just want to mention to anybody else who finds this thread.

I’m running an smtp server on my network that I’m pointing home assistant at. I had it working, then it stopped working at some point recently. The notify service would appear only if I put in an invalid IP address. I had to set verify_ssl to false in my configuration. I’m guessing a recent update changed the default value.

3 Likes

THANK YOU DAVID!!! THIS WAS IT!!! Created an account just to tell you adding that line completely fixed my issue. What a pita!

David, thanks for that update. Some recent update (or maybe in the last couple of years) broke my email notifications, and the verify_ssl: false addition to my smtp config fixed the sending issue. In the logs it would show that the notify.email service wasn’t available, and your line fixed the issue.

Thanks again!

P.S. I am running my own local email server, which might have something to do with why it’s now required. I use self signed ssl certs.

I have the same problem and errors:

2022-11-15 21:05:09.983 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/smtplib.py", line 398, in getreply
    line = self.file.readline(_MAXLINE + 1)
  File "/usr/local/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 92, 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 92, in get_service
    if mail_service.connection_is_valid():
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 154, in connection_is_valid
    server = self.connect()
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 140, in connect
    mail = smtplib.SMTP(self._server, self._port, timeout=self._timeout)
  File "/usr/local/lib/python3.10/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.10/smtplib.py", line 343, in connect
    (code, msg) = self.getreply()
  File "/usr/local/lib/python3.10/smtplib.py", line 401, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed: "
smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out