Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.smtp.notify Namespace Reference

Classes

class  MailNotificationService
 

Functions

def _attach_file (hass, atch_name, content_id="")
 
def _build_html_msg (hass, text, html, images)
 
def _build_multipart_msg (hass, message, images)
 
def _build_text_msg (message)
 
MailNotificationService|None get_service (HomeAssistant hass, ConfigType config, DiscoveryInfoType|None discovery_info=None)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
 PLATFORM_SCHEMA
 
list PLATFORMS = [Platform.NOTIFY]
 

Detailed Description

Mail (SMTP) notification service.

Function Documentation

◆ _attach_file()

def homeassistant.components.smtp.notify._attach_file (   hass,
  atch_name,
  content_id = "" 
)
private
Create a message attachment.

If MIMEImage is successful and content_id is passed (HTML), add images in-line.
Otherwise add them as attachments.

Definition at line 252 of file notify.py.

◆ _build_html_msg()

def homeassistant.components.smtp.notify._build_html_msg (   hass,
  text,
  html,
  images 
)
private
Build Multipart message with in-line images and rich HTML (UTF-8).

Definition at line 320 of file notify.py.

◆ _build_multipart_msg()

def homeassistant.components.smtp.notify._build_multipart_msg (   hass,
  message,
  images 
)
private
Build Multipart message with images as attachments.

Definition at line 305 of file notify.py.

◆ _build_text_msg()

def homeassistant.components.smtp.notify._build_text_msg (   message)
private
Build plaintext email.

Definition at line 246 of file notify.py.

◆ get_service()

MailNotificationService | None homeassistant.components.smtp.notify.get_service ( HomeAssistant  hass,
ConfigType  config,
DiscoveryInfoType | None   discovery_info = None 
)
Get the mail notification service.

Definition at line 82 of file notify.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.smtp.notify._LOGGER = logging.getLogger(__name__)
private

Definition at line 61 of file notify.py.

◆ PLATFORM_SCHEMA

homeassistant.components.smtp.notify.PLATFORM_SCHEMA
Initial value:
1 = NOTIFY_PLATFORM_SCHEMA.extend(
2  {
3  vol.Required(CONF_RECIPIENT): vol.All(cv.ensure_list, [vol.Email()]),
4  vol.Required(CONF_SENDER): vol.Email(),
5  vol.Optional(CONF_SERVER, default=DEFAULT_HOST): cv.string,
6  vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
7  vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
8  vol.Optional(CONF_ENCRYPTION, default=DEFAULT_ENCRYPTION): vol.In(
9  ENCRYPTION_OPTIONS
10  ),
11  vol.Optional(CONF_USERNAME): cv.string,
12  vol.Optional(CONF_PASSWORD): cv.string,
13  vol.Optional(CONF_SENDER_NAME): cv.string,
14  vol.Optional(CONF_DEBUG, default=DEFAULT_DEBUG): cv.boolean,
15  vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean,
16  }
17 )

Definition at line 63 of file notify.py.

◆ PLATFORMS

list homeassistant.components.smtp.notify.PLATFORMS = [Platform.NOTIFY]

Definition at line 59 of file notify.py.