SMTP not working and SMTP integration not available

Hi there, I’m trying to add an SMTP account to my HA config file but for some reason it seems to not be working.

I followed the instructions on: https://www.home-assistant.io/integrations/smtp BUT I can’t add the SMTP integration in the addons and don’t know why t s not visible to me !
This is the my config yaml part :

Example configuration.yaml entry

notify:

and the automation is as following :slight_smile:
alias: New Yahoo Automation
description: ‘’
trigger:

  • type: motion
    platform: device
    device_id: ed04f76cf7dfe42c495d4fterte1ea8
    entity_id: binary_sensor.presence_29
    domain: binary_sensor
    for:
    hours: 0
    minutes: 0
    seconds: 5
    condition: []
    action:
  • data:
    message: Intruder Alert At Home yahoo
    title: Intruder Alert YAhoo
    service: notify.yahoo1
  • service: notify.notify
    data:
    message: On Off Fenstersensor ist ON yahoo
    mode: single

This is also the log :

2021-01-11 18:23:09 ERROR (MainThread) [homeassistant.components.automation.new_yahoo_automation] New Yahoo Automation: Error executing script. Service not found for call_service at pos 1: Unable to find service notify.yahoo1
2021-01-11 18:23:09 ERROR (MainThread) [homeassistant.components.automation.new_yahoo_automation] While executing automation automation.new_yahoo_automation
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/automation/init.py”, line 404, in async_trigger
await self.action_script.async_run(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1026, in async_run
await asyncio.shield(run.async_run())
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 242, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 250, in _async_step
await getattr(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 457, in _async_call_service_step
await service_task
File “/usr/src/homeassistant/homeassistant/core.py”, line 1395, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service notify.yahoo1
Operating System : Home Assistant OS 5.10
i trayed everything but i still not receive any email
can you please help ?
Mnay thanks in advance

Please read the community guidelines, especially point 11 on formatting your code.

Looka like that your notifier is not recognized. Try commenting out the automation and restart. If the smtp configuration is vorrect, you should see a service called notify.yahoo1 under Developer Tools -> Services. Otherwise there should be an error in your logs.

thanks for your quick reaction and your comment. I did commented out the automation and restarted but still the issu: i can’t activat the smtp platform and i don’t know why !
hier ist the last log :

2021-01-11 20:38:34 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: notify
2021-01-11 20:39:05 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 268, in async_setup_platform
    notify_service = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/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 87, in get_service
    if mail_service.connection_is_valid():
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 141, in connection_is_valid
    server = self.connect()
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 127, in connect
    mail = smtplib.SMTP(self._server, self._port, timeout=self._timeout)
  File "/usr/local/lib/python3.8/smtplib.py", line 253, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.8/smtplib.py", line 337, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/local/lib/python3.8/smtplib.py", line 308, in _get_socket
    return socket.create_connection((host, port), timeout,
  File "/usr/local/lib/python3.8/socket.py", line 808, in create_connection
    raise err
  File "/usr/local/lib/python3.8/socket.py", line 796, in create_connection
    sock.connect(sa)
socket.timeout: timed out

Try changing the server to smtp.mail.yahoo.com and remove the line with timeout: for testing.

thansk for your support . I just restarted after the changes you recommanded but still not working .The SMTP is still not available as integration too and the relevant sevices also not available :cry:!
and this is the last log

2021-01-11 21:01:19 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform smtp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 268, in async_setup_platform
    notify_service = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/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 87, in get_service
    if mail_service.connection_is_valid():
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 141, in connection_is_valid
    server = self.connect()
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 134, in connect
    mail.login(self.username, self.password)
  File "/usr/local/lib/python3.8/smtplib.py", line 721, in login
    (code, resp) = self.auth(
  File "/usr/local/lib/python3.8/smtplib.py", line 633, in auth
    (code, resp) = self.docmd("AUTH", mechanism + " " + response)
  File "/usr/local/lib/python3.8/smtplib.py", line 423, in docmd
    return self.getreply()
  File "/usr/local/lib/python3.8/smtplib.py", line 396, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
2021-01-11 21:04:35 ERROR (MainThread) [homeassistant.components.generic.camera] Error getting new camera image from Generic Camera: Cannot connect to host 192.168.178.47:80 ssl:default [Connect call failed ('192.168.178.47', 80)]

It will never show up as an integration, you’ll only see the notify service if setup correctly.

I see you use the username my_HA, is this really your username for your yahoo account?

No this not my user name for yahoo

Then change it to the yahoo username and try again. This needs to be the username of the SMTP account.

IGREAT ! It Works ! I appreciate your support !
I hade to put the username as the username of the yahoo mail account ! :pray:

So… how did you rectify the SMTP add-in not being available?

I have the same issue - it used to be there (even though i never got emails working) but now it is no longer listed within the Addon catalogue.

Eureka!

I see now that smtp must be an intrinsic now. I entered a sample config for gmail and now I see the service option.

I’ll try to get the gmail working (for me) and post again.

The big takeaway here is that you DO NOT need (at least, apparently) to bring in any external component(s) to get the smtp platform.

Yep - mine works now too (gmail)

Thanks to all in this thread !!

SMTP is and was never an add-on, it’s a built in integration :slight_smile:

Happy for you too :slight_smile:
the confusion for me was that some integrations needs to be visible in order to be used, but as hade to learn not for SMTP ! I don’t know for other integrations.
the other confusion is that it will only work if aeverthing is correct means : even the username needs to be 100% and if not you will not see any clear error message refering to it
Thanks to the community for the support !

Just because it took me what seemed an inordinate amount to time to figure this one out, I provide a sample:

This is in my config file:

Gmail SMTP setup

notify:

Once added to the config, you should see those options in your notify service options as
notify.firstenmail
notify.textdailycheckin

As mentioned above, one problem is that these only work if all the syntax is correct

Please format your code properly, see point 11 in the community guidelines.

Thanks, @Burningstone for that tip. I’ll try to get that posted properly. Right now something isn’t working quite right an my post keeps showing incorrectly.

Since this took me far too long to sort out, thought I would provide a real sample

Here is my gmail setup within my config:

# Gmail SMTP setup
notify:
  - name: FirstEmail
    platform: smtp
    server: smtp.gmail.com
    port: 587
    timeout: 15
    sender: [email protected]
    encryption: starttls
    username: [email protected]
    password: ******
    recipient: [email protected]
    sender_name: HA test
    
  - name: TextDailyCheckin
    platform: smtp
    server: smtp.gmail.com
    port: 587
    timeout: 15
    sender: [email protected]
    encryption: starttls
    username: [email protected]
    password: *******
    recipient: [email protected]
    sender_name: HA test

Now when the service calls are exposed in the automations UI (actions) you should see the titles of your notify options:

notify.firstemail


notify.textdailycheckin

This seems so easy yet I have been fighting getting notifications with smtp setup for a week now.
I even copied the config from ronpro and pasted it in my yaml file. Restarted and yet i still cant call notify.email up in services under dev tools. It just doesnt show up as a notify.email.

Anyone have any ideas?

2 Likes

Вам надо проверить пароль вашего аккаунта почты. И проверить журнал сервера Home Assistant. В журнале сервера будут ошибки.