Open myriad007 opened 1 year ago
Could you give an example of a working smtp notification please
Sure, here is a header: `Return-Path: bounce+509a3a.bb6a2e-xxx=xxx.ca@mg.xxx.com Received: from mail.myriad.ca (LHLO mail.myriad.ca) (10.40.10.42) by mail.xxx.ca with LMTP; Fri, 20 Oct 2023 06:14:49 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.myriad.ca (Postfix) with ESMTP id C1B2AE2CAC for xxx@xxx.ca; Fri, 20 Oct 2023 06:14:49 -0400 (EDT) X-Virus-Scanned: amavis at mail.xxx.ca X-Spam-Flag: NO X-Spam-Score: -5.107 X-Spam-Level: X-Spam-Status: No, score=-5.107 required=6.6 tests=[BAYES_20=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Authentication-Results: mail.xxx.ca (amavis); dkim=pass (1024-bit key) header.d=mg.xxx.com Received: from mail.myriad.ca ([127.0.0.1]) by localhost (mail.myriad.ca [127.0.0.1]) (amavis, port 10024) with ESMTP id XgwOA-Bh5teY for xxx@xxx.ca; Fri, 20 Oct 2023 06:14:48 -0400 (EDT) Received: from so254-48.mailgun.net (so254-48.mailgun.net [198.61.254.48]) by mail.myriad.ca (Postfix) with ESMTPS id B1887E20AA for xxx@xxx.ca; Fri, 20 Oct 2023 06:14:48 -0400 (EDT) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.xxx.com; q=dns/txt; s=mailo; t=1697796881; x=1697804081; h=Message-Id: Date: From: From: To: To: Subject: Subject: MIME-Version: Content-Type: Sender: Sender; bh=bw94YuWhkmRuKGFz/VYyEoDZOopsMhjernUo87z8/LE=; b=OQr78NxqN5Rj+Ao20TiEl1rSn6DgcIp++jnA9FfgZa5tahMInv2O3+Oyi3M7atlOS874/9EYWkLQk47lf0iOxuRQh64xufiJD5xCJRvxG6LBlXDWuWgilc6SPjAyO1k24meJBrn62/xc+RJPCbnqEGfxRIG0zfmHQyXmuu811DY= X-Mailgun-Sending-Ip: 198.61.254.48 X-Mailgun-Sid: WyI3NTUyMCIsInJpY2hhcmRAbXlyaWFkLmNhIiwiYmI2YTJlIl0= Received: from a0d7b954-ssh.local.hass.io (lnsm5-toronto63-69-157-65-223.internet.virginmobile.ca [69.157.65.223]) by ad4ee74205aa with SMTP id 65325311293dd8a2778ca78b (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Fri, 20 Oct 2023 10:14:41 GMT Sender: noreply@mg.xxx.com Content-Type: multipart/related; boundary="===============5148013488708969329==" MIME-Version: 1.0 Subject: Front Porch Alert To: xxx@xxx.ca From: Home Assistant noreply@mg.xxx.com X-Mailer: Home Assistant Date: Fri, 20 Oct 2023 06:14:40 -0400 Message-Id: 169779688074.67.13877861563578738385@a0d7b954-ssh.local.hass.io
--===============5148013488708969329== Content-Type: multipart/alternative; boundary="===============4963668558929310845==" MIME-Version: 1.0
--===============4963668558929310845== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
A Person was detected on the Front Porch camera. Email... --===============4963668558929310845== Content-Type: text/html; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
A Person was detected on the Front Porch camera. Email...
Sorry I mean the yaml syntax for attaching an image or video in a HA notification.
Sorry, here you go:
alias: Email Frigate
description: Front Porch
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.front_porch
base_url: https://xxx.ca
title: Front Porch Alert
message: A Person was detected on the Front Porch camera. Email...
critical: "false"
alert_once: true
update_thumbnail: false
color: red
icon: >-
mdi:{{'account-outline' if label == 'Person' else 'dog' if label == 'Dog'
else 'cat' if label == 'Cat' else 'car' if label == 'Car' else
'home-assistant'}}
ios_live_view: true
labels:
- person
- dog
zone_filter: false
debug: false
sound: none
notify_group: email_notification
attachment: thumbnail
zones:
- porch
tap_action: "{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg"
cooldown: 60
action:
- service: notify.mail_1
data:
title: "Camera {{trigger.payload_json['after']['camera']}}: Motion!"
message: >-
Detected object {{trigger.payload_json['after']['label']}} by camera
{{trigger.payload_json['after']['camera']}}.<br>
Link:
https://xxx.ca/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/snapshot.jpg
data:
images:
- >-
/media-frigate/clips/{{trigger.payload_json['after']['camera']}}-{{trigger.payload_json['after']['id']}}.jpg
html: >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intruder alert</title>
</head>
<body>
<div>
<div>
<h5>Motion detected by camera: <b>{{trigger.payload_json['after']['camera']}}</b></h5>
</div>
<div>
Picture<br><img style="width: 100%; "alt="snapshot1" src="cid:{{trigger.payload_json['after']['camera']}}-{{trigger.payload_json['after']['id']}}.jpg" />
<br>
Object: {{trigger.payload_json["after"]["label"]}}
<br>
Time: '{{trigger.payload_json["after"]["start_time"]|int}}'
</div>
<div>
<p>
<h5>Links</h5>
<ul>
<li><a href="https://xxx.ca/api/frigate/notifications/{{trigger.payload_json['after']['id']}}/snapshot.jpg">Link to Snapshot</a></li>
<li><a href="https://xxx.ca/lovelace/camera">Home Assistant Cameras</a></li>
<li><a href="https://xxx.ca/media-browser">Home Assistant Media Browser</a></li>
</ul>
</p>
</div>
</div>
</body>
</html>
Hi, I was wondering if you're still having the same issue (I assume so). I also just hit this today. It would be great to see this updated to support email body embedded image. I just wish I had time to contribute.
Still waiting for some feedback from the SGT.
Thanks, sorry for the delay. So what you provided above doesn't work right? or it does but it's a custom action and you want it to work as part of the group notification?
Well, what would work for me is that the Blueprint provided most of the same information to the SMTP client as it now provides to my iPhone (minus the alert notification obviously). I just want to be able to see a thumbnail or video link and be able to launch a link to the home assistant in my Edge browser.
What i was hoping to see was what a working one looked like to compare it to what we have. I've got no experience with setting up email notifications so any pointers appreciated.
Here is an example from my old Zoneminder installation:
Describe the problem you are having or the outcome you are trying to achieve.
I have created a Notification Group to send a smtp alert to my email (which works) but there are no links or attachments inserted in the email message:
`notify:
name: ALL_DEVICES platform: group services:
name: email_notification platform: smtp server: smtp.mailgun.org port: 587 timeout: 15 sender: noreply@mg.xxx.com starttls: true username: noreply@mg.xxx.com password: hidden recipient:
Version
Frigate Notifications (0.12.0.1)
Automation config file
Frigate Config
Any other information that may be helpful
I am not sure if your awesome script can even attach anything to SMTP but I would appreciate any input you can offer.