Email with attachments

Hi to all DEVs!

Are there any plans to add the email with attachments to HA?
Apparently this is something that lots of people have already tried but only sent emails without attachments, even when using the google Mail integration.

2022

  • I want to email attachments
  • Just texts emails are fine
  • Emails are a security threat. Don’t want it.

0 voters

Already possible Is anyone able to email pictures using gmail?

Glad I hadn’t read before that it can’t be done, because I’ve been doing that for years!

I have an automation that activates on a movement sensor, then grabs a still image from two cctv cameras and saves them to a local filesystem. Then I run a script that sends an email and attaches the pictures - so I can see who’s at the door.

This is the script, for what it’s worth. Requires the Mime::Lite perl module installed and it’s run on a remote linux server.

#!/usr/bin/perl
# Send images from CCTV to me by email

use strict;
use warnings;
use MIME::Lite;

system("wget 'http://10.1.2.1/cgi-bin/viewer/video.jpg?streamid=2' -O cctv1.jpg -q");

# axis frontdoor cam
system("wget http://10.1.2.5/jpg/1/image.jpg -O cctv2.jpg -q");

my $msg = MIME::Lite->new(
                To =>'email_to_address',
                From => 'email_from_address',
                Subject =>'Driveway Sensor',
                Type =>'multipart/related' );

 $msg->attach(Type => 'text/html', Data => qq{
         <body> CCTV Footage:
         <img src="cid:myimage.jpg"> </body>
         <img src="cid:myimage2.jpg"> </body>
         } );
 $msg->attach(Type => 'image/jpg', Id => 'cctv.jpg', Path => 'cctv1.jpg', );
 $msg->attach(Type => 'image/jpg', Id => 'cctv2.jpg', Path => 'cctv2.jpg', );
  $msg->send();

system("rm cctv?.jpg");

1 Like

Actually this embeds the picture which is what I wanted in the referenced post. This person would like to include it as an attachment. I’m a noob but I haven’t seen the option of an attachment either.

I wish people would stop posting FRs when searching is available.

OK, I’m a noob, and apparetly I can’t search the comminity that wel…

Anyways, gmail integration still doesn’t send imagns.

service: notify.myemail_gmail_com
data:
  message: Test message
  target: [email protected]
  title: Upper doorbell
  images: 
    - /config/www/tmp/snapshot-doorbellsuperior.jpg

Returns:

Error running action

extra keys not allowed @ data[‘images’]. Got None

If you read the link I sent, the user was using the smtp integration.