SMTP GMAIL error

I’m getting the following error. Any suggestions on how to fix this?
using the following text. Note: quotes, dots and @ were removed so they are not links since limit is 2.

notify:

  • name: NOTIFIER_NAME
    platform: smtp
    server: smtp-gmail-com
    port: 587
    timeout: 15
    sender: YOUR_USERNAMEgmail.com
    encryption: starttls
    username: YOUR_USERNAMEgmail.com
    password: YOUR_APP_PASSWORD
    recipient:
    • RECIPIENT_1example.com
      sender_name: “SENDER_NAME”

Error setting up platform smtp
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/notify/legacy.py”, line 108, in async_setup_platform
notify_service = await hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
platform.get_service, hass, p_config, discovery_info
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/local/lib/python3.14/concurrent/futures/thread.py”, line 86, in run
result = ctx.run(self.task)
File “/usr/local/lib/python3.14/concurrent/futures/thread.py”, line 73, in run
return fn(*args, **kwargs)
File “/usr/src/homeassistant/homeassistant/components/smtp/notify.py”, line 108, in get_service
if mail_service.connection_is_valid():
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File “/usr/src/homeassistant/homeassistant/components/smtp/notify.py”, line 172, in connection_is_valid
server = self.connect()
File “/usr/src/homeassistant/homeassistant/components/smtp/notify.py”, line 165, in connect
mail.login(self.username, self.password)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.14/smtplib.py”, line 751, in login
(code, resp) = self.auth(
~~~~~~~~~^
authmethod, getattr(self, method_name),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
initial_response_ok=initial_response_ok)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.14/smtplib.py”, line 649, in auth
(code, resp) = self.docmd(“AUTH”, mechanism + " " + response)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.14/smtplib.py”, line 439, in docmd
return self.getreply()
~~~~~~~~~~~~~^^
File “/usr/local/lib/python3.14/smtplib.py”, line 412, in getreply
raise SMTPServerDisconnected(“Connection unexpectedly closed”)
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

Please follow Questions Guideline #11 by formatting your configuration example and error logs properly.

Thanks. I can’t past my text. I get the following error.
An error occurred: Sorry, new users can only put 2 links in a post.

You managed above, with some modifications. It’s the formatting that’s the problem: see the link that Didgeridrew posted. Should look like this:

notify:
    name: NOTIFIER_NAME
    platform: smtp
    server: smtp-gmail-com

…and so on.

However, suggest you use the integration:

…which sets up a notify action for you.