forked from home-assistant/home-assistant.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New example removes attachments to make it easier to follow. Clarified how the integration will appear when trying to call it in a script/automation.
- Loading branch information
1 parent
f1df617
commit d74e245
Showing
1 changed file
with
23 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ notify: | |
recipient: "YOUR_RECIPIENT" | ||
``` | ||
Check your email provider configuration or help pages to get the correct SMTP settings. | ||
Check your email provider configuration or help pages to get the correct SMTP settings. A restart of Home Assistant is required to pick up the configuration changes. | ||
{% configuration %} | ||
name: | ||
|
@@ -86,7 +86,28 @@ verify_ssl: | |
|
||
### Usage | ||
|
||
To use the SMTP notification, refer to it in an automation or script like in this example: | ||
A notify integration will be created using the name without spaces. In the above example, it will be called `notify.NOTIFIER_NAME`. To use the SMTP notification, refer to it in an automation or script like in this example: | ||
|
||
```yaml | ||
- alias: "Send E-Mail Every Morning" | ||
description: "" | ||
trigger: | ||
- platform: time | ||
at: "08:00:00" | ||
condition: [] | ||
action: | ||
- service: notify.NOTIFIER_NAME | ||
data: | ||
title: "Good Morning" | ||
message: "Rise and shine" | ||
target: | ||
- "[email protected]" | ||
mode: single | ||
``` | ||
|
||
The optional `target` field is used to specify recipient(s) for this specific service call. When `target` field is not used, this message will be sent to default recipient(s), in this example, [email protected]. | ||
|
||
Another example attaching images stored locally in a script: | ||
|
||
```yaml | ||
burglar: | ||
|
@@ -107,8 +128,6 @@ burglar: | |
- /home/pi/snapshot2.jpg | ||
``` | ||
|
||
The optional `target` field is used to specify recipient(s) for this specific service call. When `target` field is not used, this message will be sent to default recipient(s), in this example, [email protected]. | ||
|
||
The optional `html` field makes a custom text/HTML multi-part message, allowing total freedom for sending rich HTML emails by defining the HTML content. In them, if you need to include images, you can pass both arguments (`html` and `images`). The images will be attached with the basename of the images, so they can be included in the html page with `src="cid:image_name.ext"`. | ||
|
||
The optional `images` field adds image attachments to the email. If `html` is defined, the images need to be added to the message in-line as described above (and as shown in the example below). If `html` is not defined, images will be added as separate attachments. | ||
|