Can't send notification with attachment using smtp

Hi, can someone help me, I can’t send an email notification with attachment using smtp.
hassio version 0.98.1
this is my scripts

send_email_attachement:
     alias: "Send email snapshot"
     sequence:
       - service: notify.email
         data:
           message: "hello world"
           title: "hello"
           data:
             images: /tmp/snapshot.jpg

and this is the full log error that i get


Log Details (ERROR)

Sun Sep 01 2019 23:51:42 GMT+0200 (heure d’été d’Europe centrale)

Error executing script script.send_email_attachement. Unknown error for call_service at pos 1: 

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 209, in async_turn_on
    await self.script.async_run(kwargs.get(ATTR_VARIABLES), context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 151, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 235, in _handle_action
    await self._actions[_determine_action(action)](action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 318, in _async_call_service
    context=context,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 98, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 120, in async_notify_message
    await notify_service.async_send_message(**kwargs)
  File "/usr/local/lib/python3.7/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 178, in send_message
    msg = _build_multipart_msg(message, images=data.get(ATTR_IMAGES, []))
  File "/usr/src/homeassistant/homeassistant/components/smtp/notify.py", line 234, in _build_multipart_msg
    with open(atch_name, "rb") as attachment_file:
IsADirectoryError: [Errno 21] Is a directory: '/'


Are you sure you don’t have a random space in your filename? It looks like it is trying to send / as an attachment.

Also, try quoting the filename.

thanks nockrout for replying, there is no random space in the file name,
ps: it works if i use pushbullet with the same path/filename.
I tried to quote the filename, same error.

I must say I have found pushbullet the most reliable of the notify integration I have tried with HA.

PS perhaps file an issue on github.

Thanks, but the problem that i had with pushbullet, if i want to send a notification with a 30 seconds video (mp4)size of 380ko, that i have previously recorded from camera, I only receive a 3 second of the video.
This is why I trying differents solution to send video.

Same issue myself - was there a fix in the end?

sorry no. if you fix it let me know. thanks

This is an automation I have that works:

- alias: 'Door Bell'
  initial_state: True
  trigger:
    platform: state
    entity_id: binary_sensor.door_bell
    to: 'on'
  action:
   - service: notify.doorbell_email
     data:
       title: "Someone is at the door"
       message: 'Someone is at the door'
       data:
           images:
               - /config/www/cameras/front_door/snapshot/snapshot.jpg

It’s the dash sign before your picture directory reference.
Since the parameter “images” expects an array of images, the dash in front indicates that it’s an element of an array.

data:
images: /tmp/snapshot.jpg
vs

data:
images:
- /tmp/snapshot.jpg

A post was merged into an existing topic: How do I configure HA for outbound IMAP messages?