Triggering a custom SMTP notification - Falling at the first hurdle

Which protocols and ports used by SMTP can be googled.
Same goes for the general syntax of YAML

I’d wager that most of the people who are currently buying things like HomeKit and Tuya which run from an app don’t even know that you need to Google these things.

Oh, I totally agree.

Some over here argue that HA is for everybody. I’m definitely not of that opinion, at least not yet.
My opinion is that you need to be technically minded to find your way in HA.

I had not problems with integrating Tuya or Hue equipment, some of it is more or less plug and play, and some of my CCTV was extremely easy, but other parts are a real pain.

It looks like your first contribution to HA will be to the docs :slight_smile:

I sincerely hope that this is sarcasm.

Not going to lie, I don’t know enough about HA to do that.

Not Sarcasm.

So, I have the below smtp configuration which has been working fine for over a year. Now when an automation tries to use it I receive a “Service notify.outgoingsmtp not found.”. It is my assumption based on some of the thread here that it did not load after my last core update which is the last time HA was totally restarted.

This said I have a few quick questions:

  1. During the boot process does HA actually test the SMTP connection or just confim the yaml is correct before deciding to not load the smtp config?
  2. Do i have to totally reboot / restart Home Assistant to get this to load or will modifying the Yaml and reloading the yaml (assuming it is correct) get this service to load again? I have been tweaking things and only reloading the “All Yaml Configuration” from the Developer Tools page.
  3. Is there anything wrong with my code below that jumps out? Again, it has been working for over a year???

notify:

Thanks in advance for any help…

  1. Look in the logs for related messages :wink:
    If there isn’t any, please state so.

I fully restarted my HA docker at 2:00PM yesterday and there is nothing I can see in the logs. about the SMTP.

Could you please post your yaml properly.

Sorry. Never posted code before and did not know the extra steps… Here ya go!

notify:
  - name: "outgoingsmtp"
    platform: smtp
    server: "smtp.xxxxxxxx.net"
    port: 25
    timeout: 15
    verify_ssl: true
    sender: "[email protected]"
    encryption: none
    username: "[email protected]"
    password: secret! outgoingsmtp_pw
    recipient:
      - "[email protected]"
      - "[email protected]"
    sender_name: "HA Server"

It is a mystery why you have nothing in logs, but try bumping up your logging.

However you have verify_ssl as true, but no encryption set.

Not many smtp servers on the net have port 25 open - maybe this is internal to your own LAN?

No, the SMTP server is with my ISP. Is it possible they disabled the use of port 25 which had been working and changed to a different port? Still, if the Yaml is formatted correctly would an ISP change prevent this from even loading at boot? Does it test this at boot?

I has this exact problem when first setting up SMTP notifications, but it wasn’t very clear in the documentation and it took ages for someone to mention it to me.

Everything that is in your configuration file is loaded at boot. Each routine\section\whatever HA calls it, is loaded individually and is validated when it is loaded

If there is an error anywhere in a section then the section will fail to load then and there. Because it has failed to load it won’t be accessible to HA later on. This usually means that the section won’t be visible to automations or scripts, and cannot be debugged from within HA because as far as HA is concerned it doesn’t exist until it has loaded.

This is my “Notify” section in HA

notify:
  - name: email_notification
    platform: smtp
    server: "smtp.domain.com"
    port: "465"
    username: "[email protected]"
    password: "password"
    sender:  "[email protected]"
    sender_name: "Home Assistant"
    recipient:  "[email protected]"
    encryption: tls

When I first set it up I had the wrong encryption type. I put starttls instead of tls.

Because of this email_notification failed to load on boot, and wasn’t visible anywhere in HA.

Here was the thread that I started about it My thread.

As above, the answer was that I had the wrong encryption type.

I’m very new at this, so I can’t be of much help, but I would suggest that you look at the encryption type and the port first as I agree that your settings are different from what we would have expected. If you copy my code into your configuration.yaml, and then only change the server name, email address and password, and leave the rest the same. Then go from there.

My knowledge of HA is limited, but I used to be an Exchange admin. Port 25 is a relay port and is usually reserved for communications between SMTP servers, and not between a server and a client.

A lot of ISP block port 25 because - back in the day - companies would often leave the port open on their network for internal use, and if their systems were compromised it could be used to turn their servers into relay for sending out spam.

What’s possibly happened is your ISP has simply blocked the port.

I would agree with the others who are suggesting that you probably want port 465 instead.

And in case you missed my other comment, yes, this is checked at boot.

Thanks so much for the response. It was your thread above that helped me better understand what was going on. Indeed my service is not loading. Do you know if reloading my Yaml on the developers page will fix it or do I actually have to restart HA all together?

Not on boot, on start of HA.

Which happens … on boot.

Or on a restart of ha, which is much quicker and keeps your other services running.

The user asked a specific question:

if the Yaml is formatted correctly would an ISP change prevent this from even loading at boot? Does it test this at boot?

Yes, there are multiple other circumstances when this can happen, I didn’t feel the need to go in to them as that would have created thread drift.

You could have responded to the OP with some helpful advice saying that there was a faster\easier way, but instead you responded by scolding me for not doing things the exact way that you would have done.

Please limit your interactions with me.