SMTP Integration not working

Hey you guys!

I’m an IT-gal in training and one of my excersises is to set up the HA and receive e-mail notifications (MS 365) via SMTP.

Now all I get is a (for me) cryptic troubleshoot: “value should be a string @ data[‘target’][0]

I tried out many things but it still won’t work. ChatGPT doesn’t know either.
So maybe you have some input for me?

This is my yaml.config:

id: '1701953215325'
alias: SMTP Versand Server
description: SMTP Server-Versand
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.tp357_a0f1_temperature
    for:
      hours: 0
      minutes: 0
      seconds: 0
    above: 22
action:
  - service: notify.notify
    data:
      message: >-
        "Achtung! Die Temperatur im Serverraum übersteigt 22°C. Bitte
        kontrolliere die Klimaanlage."
      target:
        name: Helmut
        platform: smtp
        server: smtp.office365.com
        sender: ***************
        port: 587
        timeout: 5
        encryption: STARTTLS
        username: *************
        password: ****************
        recipient: **************
        sender_name: HomeAssistant Helmut
mode: single

Thank you so much!!!

2 Likes

That’s normal, don’t use it to help with HA.

As per the docs linked in VDRainer’s post, you seem to have combined the notify: setup and the service call in the automation.

You need the notify: block set up in configuration.yaml, then the action: part of your automation is much shorter — and the target is just the recipient address.

1 Like

Your target needs to be an email address i.e. target: [email protected]

This needs to be in your configuration.yaml file in the config directory.
Like
‘’’
notify:
- name: Helmut
platform: smtp
server: smtp.office365.com
sender: ***************
port: 587
timeout: 5
encryption: STARTTLS
username: *************
password: ****************
recipient: **************
sender_name: HomeAssistant Helmut
‘’’
After the edit restart, check in developer. then edit the automation

1 Like

Guys! Thank you so much for helping out!
It worked just fine and now I receive mails from HA!

1 Like

Big thanks to you too!
I had a bit of trouble setting up the SSH since my SD card did not have the config.yaml file. But I solved that and after inserting the config-file everything went smoothly and easily :slight_smile:

Glad to help!

1 Like