Skip to content

Email Transport Adaptor

Transport ID Source Requirements Optional
email email.py - SMTP Integration, Google Mail Integration

Can be used for plain or HTML template emails, and handle images as attachments or embedded HTML. Automatically configured if there's already an SMTP integration.

Note

The Home Assistant SMTP integration for e-mail doesn't allow priority to be set.

Pre-generated HTML

The data section of the notification can have a message_html supplied for html that will be used in place of the standard message for HTML emails and ignored for other notification types. This does not require templates, see the Restart Email Recipe for a simple example. In this case, HTML will automatically be tagged onto the end to include any attached images. The data can be configured as part of the fixed configuration, or in the data of the action call.

HTML Templates

HTML templates use the standard Home Assistant Jinja2 Templating with access to entity states, additional filters etc.

Padding to nudge e-mail clients from reading too deeply into the e-mail for in-box summaries can be tuned with preheader_blank and preheader_length configuration in the transport options. The other useful option is strict_template to switch on or off the stricter Jinja2 template validation.

Configuration

Supernotify ships with a built in template, default.html.j2 which can be used by using template: default.html.j2 in the data section. This shouldn't be edited directly, since changes will get overwritten by future releases. Instead, write your own, or amended versions of default.html.j2 and put it into a custom template directory, usually inside Home Assistant's \config directory. Templates can live in this directory, or in an email subdirectory ( the top-level is for templates that could be used with any transport, and email only for this one).

Example Supernotify Configuration
- name: SuperNotify
  platform: supernotify
  template_path: /config/templates/supernotify

Template Variables

Supernotify also adds an alert variable for context of the current notification, with these values:

Attribute Description
message Notification message
title Notification title
preheader Invisible div contents at top of html used to show info below heading
priority Notification priority
envelope Delivery Envelope (complex nested object)
subheading Defaults to "Home Assistant Notification"
server Access to name,language,internal_url and external_url of this HomeAssistant server
preformatted_html HTML supplied to the notify action, for example by an Automation
action_url Action URL for mobile action
action_url_title Title for the Action URL
img Snapshot image attachment, with url and desc fields

The preheader defaults to a minimum 100 characters packed with ͏‌  to force e-mail clients not to dig into the message contents when showing a preview in the in-box.

Image Attachments

Where the image is snapped rather than being only a URL, it will be included as an attachment and an cid:XXXX URL generated to point to the attachment name.

Info

The additional data options for Google Mail (cc,bcc,from) are not yet supported.

Default Delivery

A default Delivery called DEFAULT_email will be automatically generated for Email transport if no explicit ones created, using the first available SMTP integration if one is present. If you don't want to use it, then use configuration as below, or configure your own delivery for the transport.

transports:
  email:
    disabled: false

Reference

Home Assistant Core

Home Assistant Other

General