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.
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");
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.