Problems with sending images using SMTP integration

I’ve read just about every Google search result on HA’s SMTP integration and sending images and I still am failing.

I have the following in my configuration.yaml file:

homeassistant:
  allowlist_external_dirs:
    - "/config/media"


notify:
  - platform: smtp
    name: "family_sms"
    server: "░░░░░░.░░░░░░░░░.com"
    port: 465
    encryption: tls
    username: !secret smtp_user
    password: !secret smtp_pass
    sender: "░░░░░░░░░░░@░░░░░░░░.net"
    sender_name: Home Assistant
    recipient:
      - "░░░░░░░░░@░░░░░░░░░.com"
      - "░░░░░░░@░░░░░░.net"

My STMP recipients are an email address and a MMS recipient via email forwarder.

And this in my test automation:

alias: Camera Detection Test
description: ""
triggers: []
conditions: []
actions:
  - action: camera.snapshot
    metadata: {}
    data:
      filename: /config/media/temp4.jpg
    target:
      entity_id: camera.ai_pro_driveway_high_resolution_channel
  - action: notify.family_sms
    metadata: {}
    data:
      message: test
      title: sms test
      data:
        image:
          - /config/media/temp4.jpg
        html: |
          <img src="cid:temp4.jpg">
mode: single

By selecting “run actions” on my test automation, I’ve verified that the snapshot is actually being created:
image

and I can view it locally:

I am receiving both the email and MMS message but without the image! The email just show a broken image icon, and the MMS message just has the subject/title and the message text.

Above is the in-line image test, but I have tried sending it as an attachment by removing the two lines

        html: |
          <img src="cid:temp4.jpg">

from the automation. Results were the same. I guess it needs to be said that I also verified that I can send an email to the SMS/MMS forwarder with a picture as an attachment, or as an in-line image and successfully by using my email program. HA Core logs do not show any errors from executing the automation.

Can anyone give me an idea where to look for additional clues as to why this is not working? Thanks.

SMTP documentation says it’s images: not image:, even if there’s only one.

@TROON - OMG! thank you so much. What a stupid mistake. I’ve been beating my head against this for the whole weekend. It’s surprising that the incorrect spelling did not generate any errors.

So, attaching works for the SMS. The simple HTML embed that I had does not. I’ll have to play some more with that and see if a full HTML document will work with SMS/MMS.

It also works both ways (embed, attach) with the email address.

Again - many thanks.

1 Like

FYI to others - the Unifi Protect Integration page UniFi Protect - Home Assistant has an example where the notify portion uses image: and not images:

actions:
  - data:
      message: "Motion detected at Camera XXX"
      data:
        image: >-
          /api/unifiprotect/thumbnail/{{ config_entry_id(trigger.entity_id) }}/{{ trigger.from_state.attributes.event_id }}
        video: >-
          /api/unifiprotect/video/{{ config_entry_id(trigger.entity_id) }}/{{ trigger.from_state.attributes.event_id }}
    action: notify.mobile_app_your_device # Replace with your notification target

Be sure to check integration page for YOUR notify integration to see the correct fields for your implementation.