event.handler.smtp

Module Contents

Classes

SMTPHandler

Interface to implement in order to be able to send events.

class event.handler.smtp.SMTPHandler(subject: str, from_addr: str, to_addr: str, smtp_servers: str | list[str])

Bases: e3.event.EventHandler

Interface to implement in order to be able to send events.

One method needs to be implemented by a new EventManager:

  • send_event: method sending an event to an external service

property subject: str
classmethod decode_config(config_str: str) dict[str, str | list[str]]

Decode a config string into a dict.

Parameters:

config_str – the string containing configuration information

Returns:

a dict that can be used as **kwargs for the handler initialization method

encode_config() str

Encode the handler configuration into a string.

This default implementation can be used for handlers that do not need any configuration parameters (i.e: for which __init__ does not take any parameter apart for self).

Returns:

a string that contains the current handler configuration. The string should not contain the ‘|’ character.

send_event(event: e3.event.Event) bool

Send an event.

Parameters:

event – an event

Returns:

True if the event was sent successfully