airflow.providers.smtp.notifications.smtp

Module Contents

Classes

SmtpNotifier

SMTP Notifier.

Attributes

send_smtp_notification

class airflow.providers.smtp.notifications.smtp.SmtpNotifier(from_email, to, subject=None, html_content=None, files=None, cc=None, bcc=None, mime_subtype='mixed', mime_charset='utf-8', custom_headers=None, smtp_conn_id=SmtpHook.default_conn_name, *, template=None)[source]

Bases: airflow.notifications.basenotifier.BaseNotifier

SMTP Notifier.

Accepts keyword arguments. The only required arguments are from_email and to. Examples:

EmptyOperator(task_id="task", on_failure_callback=SmtpNotifier(from_email=None, to="myemail@myemail.com"))

EmptyOperator(
    task_id="task",
    on_failure_callback=SmtpNotifier(
        from_email="myemail@myemail.com",
        to="myemail@myemail.com",
        subject="Task {{ ti.task_id }} failed",
    ),
)
Default template can be overridden via the following provider configuration data:
  • templated_email_subject_path

  • templated_html_content_path

Parameters

smtp_conn_id (str) – The smtp connection id that contains the information used to authenticate the client.

template_fields = ('from_email', 'to', 'subject', 'html_content', 'files', 'cc', 'bcc', 'mime_subtype',...[source]
hook()[source]

Smtp Events Hook.

notify(context)[source]

Send a email via smtp server.

airflow.providers.smtp.notifications.smtp.send_smtp_notification[source]

Was this entry helpful?