bonilla
(bonilla)
November 29, 2018, 5:04pm
1
Hello!
I have a very simple question regarding the SMTP Component :
How can I attach a file on a email ? (not in-line , just a classical attachment of a file in a email)
I read this link but it is not mentionned :https://www.home-assistant.io/components/notify.smtp/
Thanks
bonilla
(bonilla)
November 30, 2018, 8:05am
2
Anyone has an idea/clue/tip , please?
I’m looking to do the same thing, did you ever figure this out?
bonilla
(bonilla)
March 24, 2019, 9:30am
4
Yes, here you go!
service: notify.email
data_template:
title: 'Someone is here'
message: "Who is it?"
data:
images:
- /tmp/snapshot1.jpg
- /tmp/snapshot2.jpg
- /tmp/snapshot3.jpg
- /tmp/snapshot4.jpg
- /tmp/snapshot5.jpg
- /tmp/snapshot6.jpg
- /tmp/snapshot7.jpg
- /tmp/snapshot8.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>Motion detected in the flat</title>
<style type="text/css">
h1,h2,h3,h4,h5,h6 {
font-family:Arial,sans-serif;
}
</style>
</head>
<body>
<h1>Motion detected</h1>
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot1.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot2.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot3.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot4.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot5.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot6.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot7.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot8.jpg" />
</html>
1 Like
This puts the images as attachments rather than in-line for you? I’m trying to use SMTP to send a MMS with picture to my phone. If I just send an email from Gmail with a picture attached it works but if it’s in-line it doesn’t.
bonilla
(bonilla)
March 25, 2019, 5:39am
6
Hello,
My example is for putting images inline on a mail (and not attached)
That’s what I thought Your original post was asking about attaching an image, not in-line
Blockquoteservice: notify.email
data_template:
title: ‘Someone is here’
message: “Who is it?”
data:
images:
- /tmp/snapshot1.jpg
- /tmp/snapshot2.jpg
- /tmp/snapshot3.jpg
- /tmp/snapshot4.jpg
- /tmp/snapshot5.jpg
- /tmp/snapshot6.jpg
- /tmp/snapshot7.jpg
- /tmp/snapshot8.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>Motion detected in the flat</title>
<style type="text/css">
h1,h2,h3,h4,h5,h6 {
font-family:Arial,sans-serif;
}
</style>
</head>
<body>
<h1>Motion detected</h1>
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot1.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot2.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot3.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot4.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot5.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot6.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot7.jpg" />
<img style="width: 100%; max-width: 640px;" alt="Image from Flat camera" src="cid:snapshot8.jpg" />
</html>
Silly question, but where do you actually put this code?
Does any of this go in the Yaml file, or does this go in the action section of an Automation?
Sorry, I’ve not be using HA long enough to know much.