Airflow Summit 2026 is coming August 31 - September 2 in Austin, TX. Register now to secure your spot!

airflow.providers.microsoft.azure.notifications.msgraph

Attributes

send_msgraph_notification

Classes

MSGraphNotifier

Send an email from an Office 365 mailbox through the Microsoft Graph sendMail endpoint.

Module Contents

class airflow.providers.microsoft.azure.notifications.msgraph.MSGraphNotifier(to, subject, html_content, from_email=None, files=None, cc=None, bcc=None, custom_headers=None, conn_id=MSGraphMailHook.default_conn_name, save_to_sent_items=True, **kwargs)[source]

Bases: airflow.providers.common.compat.notifier.BaseNotifier

Send an email from an Office 365 mailbox through the Microsoft Graph sendMail endpoint.

EmptyOperator(
    task_id="task",
    on_failure_callback=MSGraphNotifier(
        from_email="airflow@example.com",
        to="team@example.com",
        subject="Task {{ ti.task_id }} failed",
        html_content="Dag {{ ti.dag_id }} failed on {{ ds }}",
    ),
)
Parameters:
  • to (str | collections.abc.Iterable[str]) – Recipient email address or list of addresses.

  • subject (str) – Email subject.

  • html_content (str) – Email body in HTML format.

  • from_email (str | None) – The mailbox the message is sent from. Falls back to the [email] from_email configuration option.

  • files (list[str] | None) – List of file paths to attach to the email.

  • cc (str | collections.abc.Iterable[str] | None) – Carbon copy recipient email address or list of addresses.

  • bcc (str | collections.abc.Iterable[str] | None) – Blind carbon copy recipient email address or list of addresses.

  • custom_headers (dict[str, Any] | None) – Custom internet message headers, whose names have to start with “x-“.

  • conn_id (str) – The Microsoft Graph API connection id.

  • save_to_sent_items (bool) – Whether the message is saved in the mailbox’s Sent Items folder.

template_fields = ('from_email', 'to', 'subject', 'html_content', 'files', 'cc', 'bcc', 'custom_headers')[source]
to[source]
subject[source]
html_content[source]
from_email[source]
files = None[source]
cc = None[source]
bcc = None[source]
custom_headers = None[source]
conn_id = 'msgraph_default'[source]
save_to_sent_items = True[source]
property hook: airflow.providers.microsoft.azure.hooks.msgraph.MSGraphMailHook[source]

Microsoft Graph mail hook.

notify(context)[source]

Send an email through Microsoft Graph.

async async_notify(context)[source]

Send an email through Microsoft Graph (async).

airflow.providers.microsoft.azure.notifications.msgraph.send_msgraph_notification[source]

Was this entry helpful?